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.pl |
| ||
#round down to the nearest minute, exact minutes stay where they are
# input parameter is a time in epoch seconds, e.g. time()
sub TimeFloor($)
{
my ($t) = @_;
return $t - $t % 60;
}
#-- unit tests
sub test_timefloor()
{
ut::assert(TimeFloor(599), 540);
ut::assert(TimeFloor(600), 600);
ut::assert(TimeFloor(601), 600);
}
1;
|
| 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,2002,2003,2004,2005,2006,2007 |