FAQ 4.18 Does Perl have a Year 2000 or 2038 problem? Is Perl Y2K compliant?

Discussion in 'Perl Misc' started by PerlFAQ Server, Jan 6, 2011.

  1. This is an excerpt from the latest version perlfaq4.pod, which
    comes with the standard Perl distribution. These postings aim to
    reduce the number of repeated questions as well as allow the community
    to review and update the answers. The latest version of the complete
    perlfaq is at http://faq.perl.org .

    --------------------------------------------------------------------

    4.18: Does Perl have a Year 2000 or 2038 problem? Is Perl Y2K compliant?

    (contributed by brian d foy)

    Perl itself never had a Y2K problem, although that never stopped people
    from creating Y2K problems on their own. See the documentation for
    "localtime" for its proper use.

    Starting with Perl 5.11, "localtime" and "gmtime" can handle dates past
    03:14:08 January 19, 2038, when a 32-bit based time would overflow. You
    still might get a warning on a 32-bit "perl":

    % perl5.11.2 -E 'say scalar localtime( 0x9FFF_FFFFFFFF )'
    Integer overflow in hexadecimal number at -e line 1.
    Wed Nov 1 19:42:39 5576711

    On a 64-bit "perl", you can get even larger dates for those really long
    running projects:

    % perl5.11.2 -E 'say scalar gmtime( 0x9FFF_FFFFFFFF )'
    Thu Nov 2 00:42:39 5576711

    You're still out of luck if you need to keep track of decaying protons
    though.



    --------------------------------------------------------------------

    The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
    are not necessarily experts in every domain where Perl might show up,
    so please include as much information as possible and relevant in any
    corrections. The perlfaq-workers also don't have access to every
    operating system or platform, so please include relevant details for
    corrections to examples that do not work on particular platforms.
    Working code is greatly appreciated.

    If you'd like to help maintain the perlfaq, see the details in
    perlfaq.pod.
    PerlFAQ Server, Jan 6, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Generic Usenet Account

    The Year 2038 Problem

    Generic Usenet Account, May 27, 2004, in forum: C Programming
    Replies:
    248
    Views:
    3,553
    Gerry Quinn
    Aug 16, 2004
  2. Jean-Baptiste

    class Time doesn't pass year 2038?

    Jean-Baptiste, Jan 5, 2004, in forum: Ruby
    Replies:
    10
    Views:
    209
    Daniel Carrera
    Jan 7, 2004
  3. Fendi Baba
    Replies:
    5
    Views:
    133
    Fendi Baba
    Apr 4, 2004
  4. McKirahan

    Y2K? Never heard of it...

    McKirahan, Dec 27, 2004, in forum: Javascript
    Replies:
    7
    Views:
    99
    Douglas Crockford
    Dec 30, 2004
  5. Y2K problem with script?

    , Sep 29, 2005, in forum: Javascript
    Replies:
    4
    Views:
    92
    Dr John Stockton
    Sep 30, 2005
Loading...

Share This Page