Compute the total time and the draining time of the beatmap
332704
function () {
    var firstObject = beatmap.hitObjects[0];
    var lastObject  = beatmap.hitObjects[beatmap.hitObjects.length - 1];

    var totalBreakTime = 0;

    beatmap.breakTimes.forEach(function (breakTime) {
      totalBreakTime += (breakTime.endTime - breakTime.startTime);
    });

    if (firstObject && lastObject) {
      beatmap.totalTime    = Math.floor(lastObject.startTime / 1000);
      beatmap.drainingTime = Math.floor((lastObject.startTime - firstObject.startTime - totalBreakTime) / 1000);
    } else {
      beatmap.totalTime    = 0;
      beatmap.drainingTime = 0;
    }
  }
559026
function checkClientsHeartbeat() {
    var now = Date.now();
    _.forOwn(_this.socks, function (sock) {
      if (sock.hb + _this.clientTimeout < now) {
        logout(sock);
      }
    });
    setTimeout(checkClientsHeartbeat, 1000)
  }
1084135
def get_total_time(self):
        
        first_step = self.steps[0]
        last_step = self.steps[-1]
        seconds = self.history[last_step]["__timestamp__"] \
                  - self.history[first_step]["__timestamp__"]
        return datetime.timedelta(seconds=seconds)
97505
private double calculateRate(long cumulative, long currentTime) {
    long timeSinceMapStart = 0;
    assert getPhase() == Phase.MAP : "MapTaskStatus not in map phase!";

    long startTime = getStartTime();
    timeSinceMapStart = currentTime - startTime;
    if (timeSinceMapStart <= 0) {
      LOG.error("Current time is " + currentTime + 
          " but start time is " + startTime);
      return 0;
    }
    
    return cumulative/timeSinceMapStart; 
  }
813034
def total_self_time(self):
        '''
        
        '''
        self_time = self.self_time
        for child in self.children:
            if isinstance(child, SelfTimeFrame):
                self_time += child.self_time
        return self_time
1315362
def get_time_eta(total_done, total, start_time):
    
    time_done = int(time()) - start_time
    speed = total_done / time_done

    if time_done > 0 and speed > 0:
        total_to_go = total - total_done
        time_to_go = total_to_go / speed
        minutes, seconds = divmod(time_to_go, 60)
        hours, minutes = divmod(minutes, 60)
        percentage = total_done * 100.0 / total
    else:
        percentage = 0
        hours = 0
        minutes = 0
        seconds = 0

    return {
        "done": int(total_done),
        "tot": int(total),
        "%": float("{0:.2f}".format(percentage)),
        "h": int(hours),
        "m": int(minutes),
        "s": int(seconds)
    }
158911
void dumpStats() {
        long wallTimeNanos = totalStopwatch.elapsed(TimeUnit.NANOSECONDS);
        long dbtime = 0;
        for (String name : methodCalls.keySet()) {
            long calls = methodCalls.get(name);
            long time = methodTotalTime.get(name);
            dbtime += time;
            long average = time / calls;
            double proportion = (time + 0.0) / (wallTimeNanos + 0.0);
            log.info(name + " c:" + calls + " r:" + time + " a:" + average + " p:" + String.format("%.2f", proportion));
        }
        double dbproportion = (dbtime + 0.0) / (wallTimeNanos + 0.0);
        double hitrate = (hit + 0.0) / (hit + miss + 0.0);
        log.info("Cache size:" + utxoCache.size() + " hit:" + hit + " miss:" + miss + " rate:"
                + String.format("%.2f", hitrate));
        bloom.printStat();
        log.info("hasTxOut call:" + hasCall + " True:" + hasTrue + " False:" + hasFalse);
        log.info("Wall:" + totalStopwatch + " percent:" + String.format("%.2f", dbproportion));
        String stats = db.getProperty("leveldb.stats");
        System.out.println(stats);

    }
935128
def _hours(t0, t):
		
		if not isinstance(t, Iterable):
			return Tide._hours(t0, [t])[0]
		elif isinstance(t[0], datetime):
			return np.array([(ti-t0).total_seconds() / 3600.0 for ti in t])
		else:
			return t
144221
def total_time(self):
        """"""
        now_playing = self._setstate.nowPlayingInfo
        if now_playing.HasField('duration'):
            return int(now_playing.duration)

        return None
758245
function getRemainingTimeBonus(events, timeBonus) {
  const turnCount = getTurnCount(events);
  const remainingTimeBonus = timeBonus - turnCount;
  return Math.max(remainingTimeBonus, 0);
}
956119
def make_timebar(progress=0, duration=0):
    

    duration_string = api_music.duration_to_string(duration)
    if duration <= 0:
        return "---"

    time_counts = int(round((progress / duration) * TIMEBAR_LENGTH))
    if time_counts > TIMEBAR_LENGTH:
        time_counts = TIMEBAR_LENGTH

    if duration > 0:
        bar = "│" + (TIMEBAR_PCHAR * time_counts) + (TIMEBAR_ECHAR * (TIMEBAR_LENGTH - time_counts)) + "│"
        time_bar = "{} {}".format(bar, duration_string)
    else:
        time_bar = duration_string

    return time_bar
1168815
function (offset) {
    for (var i = beatmap.timingPoints.length - 1; i >= 0; i--) {
      if (beatmap.timingPoints[i].offset <= offset) { return beatmap.timingPoints[i]; }
    }
    return beatmap.timingPoints[0];
  }
656749
def get(self):
        """"""
        elapsed = datetime.now() - self._previous
        self._previous += elapsed
        return elapsed.total_seconds()
1245391
@SuppressWarnings("WeakerAccess")
    public int findBeatAtTime(long milliseconds) {
        int found = Arrays.binarySearch(timeWithinTrackValues, milliseconds);
        if (found >= 0) {  // An exact match, just change 0-based array index to 1-based beat number
            return found + 1;
        } else if (found == -1) {  // We are before the first beat
            return found;
        } else {  // We are after some beat, report its beat number
            return -(found + 1);
        }
    }
1202387
function () {
        var unixTime = jsdate.getTime() / 1000;
        var secondsPassedToday = unixTime % 86400 + 3600; // since it's based off of UTC+1
        if (secondsPassedToday < 0) { secondsPassedToday += 86400; }
        var beats = ((secondsPassedToday) / 86.4) % 1000;
        if (unixTime < 0) {
          return Math.ceil(beats);
        }
        return Math.floor(beats);
      }
870330
function getTimestamp(rawTx) {
  const timestamp = get(
    rawTx,
    ['meta', 'metronome', 'export', 'blockTimestamp'],
    null
  )
  return timestamp ? Number(timestamp) : null
}
992614
function time(key, fn) {
        if (typeof data[key] === "undefined") {
            data[key] = 0;
        }

        return function(...args) {
            let t = process.hrtime();

            fn(...args);
            t = process.hrtime(t);
            data[key] += t[0] * 1e3 + t[1] / 1e6;
        };
    }