Round the time (in seconds) up to the next minute. If the time is already an even minute, nothing is changed.
Download timeceiling.zip
Synopsis: |
| timeceiling.py |
| ||
#round up to the nearest minute, exact minutes stay where they are # input parameter is a time in epoch seconds, e.g. time.time() def TimeCeiling(t): offset = t % 60 if offset > 0: t = t + 60 - offset return t #-- unit tests def test_timeceiling(): ut.utassert(TimeCeiling(599), 600) ut.utassert(TimeCeiling(600), 600) ut.utassert(TimeCeiling(601), 660) #import time #print "t=" + str(TimeCeiling(time.time())) |
| Contact me about content on this page using john_web-at-arrizza-dot-com |
| For Web Master or site problems contact: webadmin-at-arrizza-dot-com |
| Copyright John Arrizza (c) 2001-2010 |