MCPcopy
hub / github.com/django/django / duration_string

Function duration_string

django/utils/duration.py:18–28  ·  view source on GitHub ↗

Version of str(timedelta) which is not English specific.

(duration)

Source from the content-addressed store, hash-verified

16
17
18def duration_string(duration):
19 """Version of str(timedelta) which is not English specific."""
20 days, hours, minutes, seconds, microseconds = _get_duration_components(duration)
21
22 string = "{:02d}:{:02d}:{:02d}".format(hours, minutes, seconds)
23 if days:
24 string = "{} ".format(days) + string
25 if microseconds:
26 string += ".{:06d}".format(microseconds)
27
28 return string
29
30
31def duration_iso_string(duration):

Callers 11

prepare_valueMethod · 0.90
value_to_stringMethod · 0.90
test_simpleMethod · 0.90
test_daysMethod · 0.90
test_microsecondsMethod · 0.90
test_negativeMethod · 0.90
test_simpleMethod · 0.90
test_daysMethod · 0.90
test_microsecondsMethod · 0.90
test_negativeMethod · 0.90

Calls 2

_get_duration_componentsFunction · 0.85
formatMethod · 0.45

Tested by 9

test_simpleMethod · 0.72
test_daysMethod · 0.72
test_microsecondsMethod · 0.72
test_negativeMethod · 0.72
test_simpleMethod · 0.72
test_daysMethod · 0.72
test_microsecondsMethod · 0.72
test_negativeMethod · 0.72