Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

New time-related function for Perl

by Dominus (Parson)
on Apr 01, 2001 at 21:58 UTC ( #68855=perlmeditation: print w/replies, xml ) Need Help??

Not long ago, I noticed that an important time-related function was missing from the Perl built-in function set. The manual says (for example):
Returns the number of non-leap seconds since whatever time the system considers to be the epoch
but it's hard to write reliable applications if you don't know what the system considers to be the epoch! It is a aprticularly large problem for applications that must be portable between platforms---you might port the program to a system with a different idea of the epoch, and then the program's interpretation of time values would be incorrect.

Anyway, I resolved to fix this, and recently submitted a patch for Perl 5.7.0. It adds a new epochtime function that returns the time at which the epoch occurs. Rather than post the entire patch here, I'll just provide a link.

Replies are listed 'Best First'.
Re: New time-related function for Perl
by jorg (Friar) on Apr 02, 2001 at 00:37 UTC
    Jarkko Hietaniemi (apparently one of the list moderators) said the following to your patch : "I'm sorry but this is not portable to the Mayan calendar in EBCDIC Amigas."
    I wasn't aware that the Maya tribe was into the Amiga scene..Would you care to comment on this one dominus?


    "Do or do not, there is no try" -- Yoda
Re: New time-related function for Perl
by Anonymous Monk on Apr 02, 2001 at 12:36 UTC
    What exactly does this do? If time() returns the number of seconds since the epoch, then 0 would be 0 seconds since the epoch and you can use the normal time functions with time 0 to figure out all the information you need about the epoch, so what exactly does epochtime do?
      +PP(pp_epochtime) +{ + dSP; + EXTEND(SP, 1); + PUSHs(sv_2mortal(newSViv(0))); + RETURN; +}

      Yes, this just returns 0. It appears to be an April Fool's joke that many (including the producers of "This week on p5p") didn't get (probably because it wasn't funny).

              - tye (but my friends call me "Tye")
        Well, I thought it was funny, especially because the patch included updates to the documentation and the test suite!

        A joke doesn't have to be obvious to be funny.

        Says tye:
        many (including the producers of "This week on p5p") didn't get
        Simon did indeed get it. Don't give yourself so much credit.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://68855]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2018-06-24 22:45 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.