Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Converting epoch times after 2038

by kurre_vaxholm (Acolyte)
on Apr 05, 2007 at 06:51 UTC ( [id://608426]=note: print w/replies, xml ) Need Help??


in reply to Re: Converting epoch times after 2038
in thread Converting epoch times after 2038

I am using the default one. Do you think that DateTime::Format::Epoch will do the trick?? I'll look it up on CPAN...
  • Comment on Re^2: Converting epoch times after 2038

Replies are listed 'Best First'.
Re^3: Converting epoch times after 2038
by ikegami (Patriarch) on Apr 05, 2007 at 07:01 UTC

    Apparently, it does:

    use DateTime qw( ); use DateTime::Format::Epoch qw( ); my $epoch = DateTime->new( year => 1970, month => 1, day => 1 ); my $formatter = DateTime::Format::Epoch->new( epoch => $epoch ); my $dt = $formatter->parse_datetime( 3700771200 ); print( $dt->strftime( '%x %X' ), "\n" ); # Apr 10, 2087 12:00:00 AM

    Update: Better yet:

    use DateTime::Format::Epoch::Unix qw( ); my $dt = DateTime::Format::Epoch::Unix->parse_datetime( 3700771200 ); print( $dt->strftime( '%x %X' ), "\n" ); # Apr 10, 2087 12:00:00 AM
      Hi ikegami Thanks for the response. Are you on a 64 bit system or a 32?? Cause 32 bit system can only handle epoch before 2038 (2**32) if they rely on the unix built in timegm..
        Cause 32 bit system can only handle epoch before 2038 (2**32) if they rely on the unix built in timegm..

        The CPU architecture can be 32 bit, as long as a larger size of value is used for times. The code he posted works for me on FreeBSD, on a 32-bit x86 system. Apr 10, 2087 it says.

        -- 
        We're working on a six-year set of freely redistributable Vacation Bible School materials.

        Did you try it? WinXP on a 32-bit Pentium 4.

        Even if the CPU doesn't support 64-bit arithmetic — I don't know whether it does or not — it can still be done by software. Think about it... entire CPUs can be emulated in software.

        However, I'm guessing the module doesn't use 64-bit arithmetic (hardware or software), but rather floating point numbers. They have 56-bit of precision on my system.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://608426]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-25 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found