Return a string with time for the contest to begin/end
761163
def get_time_string(contest, contest_type):
  """"""

  if contest_type == challenge().ACTIVE:
    time_diff = time_difference(contest["end"])
  elif contest_type == challenge().UPCOMING:
    time_diff = time_difference(contest["start"])
  elif contest_type in [challenge().HIRING, challenge().SHORT, challenge().ALL]:
    try:
      time_diff = time_difference(contest["start"])
    except:
      time_diff = time_difference(contest["end"])
  time_diff_string = ""

  if time_diff.days > 0: 
    time_diff_string = "{0} days {1} hours".format(time_diff.days, time_diff.hours)
  elif time_diff.hours > 0:
    time_diff_string = "{0} hours {1} minutes".format(time_diff.hours, time_diff.minutes)
  else:
    time_diff_string = "{0} minutes".format(time_diff.minutes)
  return time_diff_string
943115
def _duration(start, end):
    
    if start and end:
        if start > end:
            return None
        else:
            return end - start
    elif start:
        return time.time() - start
    else:
        return None
495448
def entries(self, start = None, end = None):
        ''''''
        if not start:
            start = self.earliest_record
        if not end:
            end = self.latest_record
        fr = start.strftime('%Y%m%d')
        to = end.strftime('%Y%m%d')
        url = str.format(
            'projects/{}/entries?from={}&to={}',
            self.id,
            fr,
            to,
        )
        response = self.hv.get_request(url)
        return [Entry(self.hv, ej['day_entry']) for ej in response]
1033041
def getTimes(dataTasks):
    """"""
    global begin_time
    start_time, end_time = float('inf'), 0
    for fichier, vals in dataTask.items():
        try:
            if hasattr(vals, 'values'):
                tmp_start_time = min([a['start_time'] for a in vals.values()])[0]
                if tmp_start_time < start_time:
                    start_time = tmp_start_time
                tmp_end_time = max([a['end_time'] for a in vals.values()])[0]
                if tmp_end_time > end_time:
                    end_time = tmp_end_time
        except ValueError:
            continue
    begin_time = 1000 * start_time
    return 1000 * start_time, 1000 * end_time
1038257
def get_elapsed(self, restart=True):
        '''
        
        '''
        end = time.time()
        span = end - self.__start
        if restart:
            self.__start = end
        return span
810364
def to_short_time_string(self) -> str:
        
        hour = self.time.hour
        minute = self.time.minute
        return f"{hour:02}:{minute:02}"
227949
def end_time(self):
        """"""
        try:
            return self.start_time + SCAN_DURATION[self.sector]
        except KeyError:
            return self.start_time
1031945
def timethis(label, receiver_fn=None):
    

    start = time.time()
    try:
        yield
    finally:
        end = time.time()
        if receiver_fn:
            receiver_fn(label, start, end)
        else:
            print('{}: {} to {} -> {} seconds'.format(label, start, end, end-start))
604504
def end_time(self):
        
        return float(self.strain.start_time + (len(self.strain) - self.total_corruption) / self.sample_rate)
1348198
def show_time_as_short_string(self, seconds):
        
        if seconds < 60:
            return str(seconds) + ' seconds'
        elif seconds < 3600:
            return str(round(seconds/60, 1)) + ' minutes'
        elif seconds < 3600*24:
            return str(round(seconds/(60*24), 1)) + ' hours'
        elif seconds < 3600*24*365:
            return str(round(seconds/(3600*24), 1)) + ' days'
        else:
            print('WARNING - this will take ' + str(seconds/(60*24*365)) + ' YEARS to run' )
            return str(round(seconds/(60*24*365), 1)) + ' years'
468156
function(string, t0)
	{
		if (mxLog.TRACE)
		{
			var dt = (t0 != 0) ? ' ('+(new Date().getTime() - t0)+' ms)' : '';
			mxLog.writeln('Leaving '+string+dt);
		}
	}
560551
def P(self):
        
        if self.data.minute == 0 and self.data.hour == 0:
            return _('midnight')
        if self.data.minute == 0 and self.data.hour == 12:
            return _('noon')
        return u'%s %s' % (self.f(), self.a())
1089464
def get_timerange(self, start, end, code=None):
        
        try:
            return self.data.loc[(slice(pd.Timestamp(start), pd.Timestamp(end)), slice(code)), :]
        except:
            return ValueError('CANNOT FOUND THIS TIME RANGE')
1296863
function getLetterTime(timeString) {
  var totalSeconds = 0;
  var timeValues = {
    's': 1,
    'm': 1 * 60,
    'h': 1 * 60 * 60,
    'd': 1 * 60 * 60 * 24,
    'w': 1 * 60 * 60 * 24 * 7,
  };
  var timePairs;

  //expand to "1 h 30 m 20 s" and split
  timeString = timeString.replace(/([smhdw])/g, ' $1 ').trim();
  timePairs = timeString.split(' ');

  for (var i = 0; i < timePairs.length; i += 2) {
    totalSeconds += parseInt(timePairs[i], 10) *
      timeValues[timePairs[i + 1] || 's'];
  }
  return totalSeconds;
}
218109
function printTimingAndExit(startTime) {
  const execTime = time() - startTime;

  printColumns(chalk.green(`Finished in: ${execTime.toFixed()}ms`));
  process.exit(0);
}
161272
def execute(self, string, max_tacts=None):
        """"""
        counter = 0
        self.last_rule = None

        while True:
            string = self.execute_once(string)
            if self.last_rule is None or self.last_rule[2]:
                break
            counter += 1
            if max_tacts is not None and counter >= max_tacts:
                raise TimeoutError("algorithm hasn't been stopped")

        return string
380071
def timeframe(self, start, end):
        
        """
        if start:
            self._time_frame['chfieldfrom'] = start
        if end:
            self._time_frame['chfieldto'] = end
        return self