in reply to Simple date and time manipulation

I would suggest keeping the time in epoch time and incrementing by (((60 * 1) + 22 ) *60 ) + 33) seconds each iteration. you could then write an ISO_date_format function to return the value of date in the preferred time format, eg.
sub ISO_date_format{ my $epoch_date = shift; my @localtime = localtime($epoch_date); my $iso_date = sprintf ("%4d-%0.2d-%0.2d", $localtime[5] + 1900, $localtime[4]+ 1, $localtime[3]); return ($iso_date); }
This could of course be shortened for less clarity

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Replies are listed 'Best First'.
Re^2: Simple date and time manipulation
by thargas (Deacon) on Jan 19, 2011 at 12:52 UTC
    Since you're using UTC, you don't have to worry about DST, but leap seconds may still be a consideration. You don't say if this is a one-shot program, nor whether the times may be in the future. With leap seconds, future times cannot be accurately predicted. If you're not worried about leap-seconds, just adding the appropriate offset as Utilitarian suggests is probably your best bet.