Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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.

Comment on New time-related function for Perl
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?


    Jorg

    "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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://68855]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (14)
As of 2014-07-10 21:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (216 votes), past polls