round time down to next minute

Round the time (in seconds) down to the minute. If the time is already an even minute, nothing is changed.

Download timefloor.zip

Synopsis:

timefloor.py


timefloor.py

Synopsis
#round down to the nearest minute, exact minutes stay where they are
#   input parameter is a time in epoch seconds, e.g. time()
def TimeFloor(t):
  return t - t % 60

#-- unit tests
def test_timefloor():
  ut.utassert(TimeFloor(599), 540)
  ut.utassert(TimeFloor(600), 600)
  ut.utassert(TimeFloor(601), 600)






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