in reply to localtime/strftime not behaving as expected

so, what did I miss?

A demonstration that demonstrates the problem

$ perl -E " say scalar localtime; sleep 2; say scalar localtime; " Thu Feb 21 16:52:56 2013 Thu Feb 21 16:52:58 2013

As you can see, two seconds later is two seconds later, its two seconds later

Maybe you override localtime with another function which caches the value, who knows

Replies are listed 'Best First'.
Re^2: localtime/strftime not behaving as expected
by sdetweil (Sexton) on Feb 22, 2013 at 02:43 UTC
    Thx.. as far as I am aware I do not overlay or alias localtime() anywhere that would cause a cached value I have a statement as the second line of my app
    open DEBUG, ">", "debug.txt"; print DEBUG "Begin: Debug " . strftime( '%m-%d-%Y %H:%M:%S', localtim +e() ) . "\n";

    I have a statement before & after I unzip the help file.
    and before/after I load my product reference files (this one I expect to be the trouble area. On windows it uses Find to get the individual lines in my product config files that matter. On my dev system it takes 2.4-2.5 seconds (timed with another language script wrapper)
    my $ok; use Archive::Zip; my $z = Archive::Zip->new(); eval { $ok = $z->read($HelpFile); }; if ( $ok == 0 ) { if ($debug) { print DEBUG "Start unzip help " . strftime( '%m-%d-%Y %H: +%M:%S', localtime() ) . "\n"; } # unzip the new copy of the scripts into the update folder mkdir './help'; $ok = $z->extractTree( 'help', 'help' ); if($debug) { print DEBUG "End unzip help " . strftime( '%m-%d-%Y %H: +%M:%S', localtime() ) . "\n"; } } undef $z; unlink($HelpFile); if ($debug) { print DEBUG "Begin: Populating product names." . strftime( '%m +-%d-%Y %H:%M:%S', localtime() ) ."\n"; } populateProductNames(); $products = [@products]; if ($debug) { print DEBUG "End: Populating product names." . strftime( '%m-% +d-%Y %H:%M:%S', localtime() ) ."\n"; }
    and I have one just before I put up my wxPerl app window
    if ($debug) { use POSIX 'strftime'; print DEBUG "Starting window loop " . strftime( '%m-%d-%Y %H:%M:%S +', localtime() ) . "\n"; } $app->MainLoop;
    and I see this
    Begin: Debug 02-21-2013 12:09:54
    Start unzip help  02-21-2013 12:09:54
    End   unzip help  02-21-2013 12:09:54
    Begin: Populating product names.02-21-2013 12:09:54
    End: Populating product names.02-21-2013 12:09:54
    Starting window loop 02-21-2013 12:09:54