Project

General

Profile

« Previous | Next » 

Revision 3b9314ca

Added by David Sorber over 7 years ago

Fix logic bug when calculating time diffs. Version 0.1.3.

View differences:

software/hbkcd/hbkcd/daemon.py
""" Helper function to calculate the elapsed time between to datetime
objects and return in a readable "HH::MM:SS" string format.
"""
elapsed = dt_end - dt_start
elapsed = dt_start - dt_end
hours, remainder = divmod(elapsed.total_seconds(), 3600)
minutes, seconds = divmod(remainder, 60)
elapsed_str = '{:02}:{:02}:{:02}'

Also available in: Unified diff