in reply to Re: Print Interval Instead of Timestamp
in thread Print Interval Instead of Timestamp

Another approach would be to make a simple subroutine that rounds the time down to the nearest 5-minute mark. This would be a lot easier to maintain (and change the interval, if desired). It would basically go something like this:

  1. adjust minute value by adding seconds / 60
  2. use Math::Round to round down to the nearest multiple of choice (use a variable instead of 5 to make it easily customizable):
  3. $minutes_binned = nearest_floor( 5, $minutes_floating );
  4. return binned minute