Created
December 8, 2014 12:39
-
-
Save kangasbros/8b37f7ba4e0de623b691 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def timedelta_to_tuple(td): | |
"""Return an (hours, minutes) tuple | |
""" | |
tot_secs = abs(td.total_seconds()) | |
remaining_secs = tot_secs % 3600 | |
hours = (tot_secs - remaining_secs) / 3600 | |
return int(hours), int(round(remaining_secs/60)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment