Some time back there was talk about the difference between Time::Local::timelocal() and POSIX::mktime(). Figuring C is faster than perl, I thought of going with POSIX rather than Time::Local, however there's a few things I've noticed:
POSIX doesn't get any finer than seconds, Time::Local will.
use POSIX;
use Time::Local;
print POSIX::mktime(40.347012, 24, 18, 19, 00, 103) . "\n";
print timelocal(40.347012, 24, 18, 19, 00, 103) . "\n";
__END__
Returns:
1043000680
1043000680.34701
On a mac POSIX returns some strange value
(MacPerl under MacOS 9.22) Now before you jump up and down, the strange number has nothing to do with the number of seconds between mac-epoch and unix-epoch. I've tried that and I still get a strange number. Is POSIX broken on mac?
Now, with all of that: If Time::Local is now core, should I just use it's perl-only approach? Will it be slower than POSIX and if so, will it be noticable? Will Time::Local work on all platforms?
ALSO Is either of them going to work with dates > 2038?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.