Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

perl 5.8 shows wrong timestamp on cygwin

by tos (Deacon)
on Apr 21, 2004 at 15:38 UTC ( #347035=perlquestion: print w/replies, xml ) Need Help??

tos has asked for the wisdom of the Perl Monks concerning the following question:

Hello friends,

given: two perl-versions on a windows xp(svp1)-system.

  1. perl: (revision 5.0 version 8 subversion 2), Platform: osname=cygwin, osvers=1.5.5(0.9432)
  2. aperl: (revision 5 version 6 subversion 1) configuration: Platform: osname=MSWin32, osvers=4.0

The correct (system-)time is shown by activePerl
# aperl -we 'use Time::localtime;print ctime()' Wed Apr 21 17:11:38 2004
Thought cygwin shows this time, too ...
# date Wed Apr 21 17:11:42 2004
perl 5.8 doesn't but prints (presumably) the gmtime instead.
# perl -we 'use Time::localtime;print ctime()' Wed Apr 21 15:11:45 2004
What's to do for sychronizing ?

Thanks in advance and regards,

tos at cologne/rhine/GMT+01:00


Is simplicity best or simply the easiest Martin L. Gore

Replies are listed 'Best First'.
Re: perl 5.8 shows wrong timestamp on cygwin
by xorl (Deacon) on Apr 21, 2004 at 15:53 UTC

    I think the problem is that under cygwin localtime returns GMTime.

    There's a solution here:

    http://www.mail-archive.com/cygwin@cygwin.com/msg37313.html

    which says "use POSIX 'tzset'; tzset()" before calling localtime.

    I haven't tested it. So use at your own risk.

    -XorL

    Update: just fixed a typo.

      Don't be too self-critical xorl. You aren't (imho) an I. ;)

      Thanks for your hint. Regards, tos

      p.s.: no risk, but fun ...

      works fine

      # date Thu Apr 22 07:38:57 2004 # perl -we 'use POSIX "tzset";tzset();use Time::localtime;print ctime( +)' Thu Apr 22 07:38:59 2004

      Is simplicity best or simply the easiest Martin L. Gore
Re: perl 5.8 shows wrong timestamp on cygwin
by ysth (Canon) on Apr 21, 2004 at 16:33 UTC
    This is a cygwin bug that affected threaded perl.

    I believe this was fixed in cygwin-1.5.9. If not, it is fixed in current snapshots and the fix will be in 1.5.10.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2021-10-16 07:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (69 votes). Check out past polls.

    Notices?