MCPcopy Index your code
hub / github.com/cirosantilli/linux-kernel-module-cheat / seconds_to_hms

Method seconds_to_hms

common.py:936–948  ·  view source on GitHub ↗

Seconds to hour:minute:seconds :ptype seconds: float :rtype: str https://stackoverflow.com/questions/775049/how-do-i-convert-seconds-to-hours-minutes-and-seconds

(seconds)

Source from the content-addressed store, hash-verified

934
935 @staticmethod
936 def seconds_to_hms(seconds):
937 '''
938 Seconds to hour:minute:seconds
939
940 :ptype seconds: float
941 :rtype: str
942
943 https://stackoverflow.com/questions/775049/how-do-i-convert-seconds-to-hours-minutes-and-seconds
944 '''
945 frac, whole = math.modf(seconds)
946 hours, rem = divmod(whole, 3600)
947 minutes, seconds = divmod(rem, 60)
948 return '{:02}:{:02}:{:02}'.format(int(hours), int(minutes), int(seconds))
949
950 def print_time(self, ellapsed_seconds):
951 if self.env['print_time'] and not self.env['quiet']:

Callers 2

print_timeMethod · 0.95
__str__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected