in reply to Check out PerlMonth

I'm opionated enough to review anything.

I looked over the site, and though I have nothing to say, yet, about your column, I was reading some of the features. I came across one from issue 5 about localtime().

I couldn't help but mess around. Seems there are many differences between mainline Perl and the ActivePerl for NT I'm using. Several functions don't work, or need to be call more explicitly (which may be a good habit).

Of note, though, the epoch under NT is apparently set to June 3, 1970, at 5:41:04.

-Travis

Replies are listed 'Best First'.
NT Epoch (RE: Check out PerlMonth)
by Anonymous Monk on Feb 09, 2000 at 02:21 UTC
    The Epoch in NT and Win95 with ActivePerl is Jan 1, 1970 at 00:00:00 GMT as it should be.

    Try This:

    @DoW = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); @MoY = ('Jan','Feb','Mar','Apr','May','Jun', 'Jul','Aug','Sep','Oct','Nov','Dec'); $TZ = "GMT"; ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = gmtime +(0); #seconds after epoch $year += 1900; $date = sprintf("%s %s %02d %2d:%02d:%02d %.3s %4d\n", $DoW[$wday], $MoY[$mon], $mday, $hour, $min, $sec, $TZ, $year); print ("$date\n");
    You should get something like: Thu Jan 01 0:00:00 GMT 1970

    alternately, 13239664 seconds after the epoch gives you June 3, 1970, at 5:41:04

    This works under both Win95 and WinNT