// Generated by IcedCoffeeScript 1.7.1-c
(function() {
  var Timer, time;

  exports.time = time = function() {
    return (new Date()).getTime();
  };

  exports.Timer = Timer = (function() {
    function Timer(opts) {
      this.reset();
      if (opts != null ? opts.start : void 0) {
        this.start();
      }
    }

    Timer.prototype.start = function() {
      if (!this._running) {
        this._ts = time();
        return this._running = true;
      }
    };

    Timer.prototype.stop = function() {
      if (this._running) {
        this._total += time() - this._ts;
        this._running = false;
      }
      return this._total;
    };

    Timer.prototype.is_running = function() {
      return this._running;
    };

    Timer.prototype.total = function() {
      return this._total;
    };

    Timer.prototype.reset = function() {
      this._running = false;
      this._total = 0;
      return this._ts = 0;
    };

    return Timer;

  })();

}).call(this);
