in reply to Round time to nearest 15 or 30 minutes
Just how tied to the hash are you? Assuming you have a function call such as: myfunc($ts, $interval), then something like the following might also be worth considering:
as it appears to provide the same results you seek, but perhaps with a little less brain-damage....sub myfunc { my ($ts, $interval) = @_; my $minute; # # Somehow get $minute from $ts, # using the method of your choice. # # Ex., using the method in the OP... $minute = substr($ts, 10, 2); return $interval * int($minute / $interval); }
Hope that helps.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Round time to nearest 15 or 30 minutes
by jesuashok (Curate) on Apr 25, 2006 at 04:02 UTC | |
by DrHyde (Prior) on Apr 25, 2006 at 10:05 UTC | |
by bill_mcgonigle (Acolyte) on May 18, 2010 at 01:04 UTC |