Beispiel #1
0
  def _format_value(self, value):

    # Format timedelta as HH:MM:SS
    if isinstance(value, timedelta):
      return seconds_humanize(value.total_seconds())

    return value
Beispiel #2
0
def total_time(t, short=False):
    '''
  Display total time as a nicely formatted string
  from a timestamp or timedelta
  '''
    if isinstance(t, timedelta):
        t = t.total_seconds()

    return seconds_humanize(t, short)
Beispiel #3
0
def total_time(t, short=False):
    """
  Display total time as a nicely formatted string
  from a timestamp or timedelta
  """
    if isinstance(t, timedelta):
        t = t.total_seconds()

    return seconds_humanize(t, short)
Beispiel #4
0
def convert_speed(s):
    '''
  Convert a speed in m/s
  to a nicer time display in min/km
  '''
    return s > 0 and seconds_humanize(1000.0 / s, True) or 0
Beispiel #5
0
def convert_speed(s):
    """
  Convert a speed in m/s
  to a nicer time display in min/km
  """
    return s > 0 and seconds_humanize(1000.0 / s, True) or 0