my $now1 = now_day() ;
midnight happens NOW!!!
my $now2 = now_hour() ;
my $timestamp = "$now1:$now2" ;
that is not the value you expect. a bug. not a likely bug but
effectively similar to a race condition.
Yeah, but wouldn't this actually be the same as doing:
my $date1 = strftime( 'whatever', localtime() );
# midnight occurs
my $date2 = strftime( 'whatever', localtime() );
The solution, of course, is to let the 'now()' function do the formatting
for you (ie. you only need to call it once):
my $format = '%DD%:%hh%';
my $timestamp = now( $format );
yes, you did. you didn't understand the possibility of time changing
between now*() calls.
Actually, I did. But as a programmer I'm aware of the possibilities of
race conditions, so I avoid them.