This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi all, I want to ask you how convert time between different timezones in perl script running under cygwin. I have an application which store datetime information in Zulu/GMT. I need to provide date in user timezone. How to do the correct conversion? I want to be able to offer Timezone info like 'Europe/Prague'. Following code snippet will provide correct output when running under Active state Perl (time will differ 1 or 2 hours depending on input date), but when running under cygwin perl no conversion will be done. Can anyone help me? $ENV{TZ} = 'Zulu'; POSIX::tzset(); $time = timegm($second, $minute, $hour, $day, $month, $year); $ENV{TZ} = 'Europe/Prague'; POSIX::tzset(); ($second, $minute, $hour, $day, $month, $year) = POSIX::localtime($time); Attached program will produce under ActiveState PERL Winter (delta should be +1 h) ZULU : 2007-12-13 11:47:02 Zulu LOCAL: 2007-12-13 12:47:02 Europe/Prague Summer (delta should be +2 h) ZULU : 2007-06-13 11:47:02 Zulu LOCAL: 2007-06-13 13:47:02 Europe/Prague and under CygWin PERL output will be Winter (delta should be +1 h) ZULU : 2007-12-13 11:47:02 Zulu LOCAL: 2007-12-13 11:47:02 Europe/Prague Summer (delta should be +2 h) ZULU : 2007-06-13 11:47:02 Zulu LOCAL: 2007-06-13 11:47:02 Europe/Prague Best Regards, Roman
Attachment:
test-1.pl
Description: Perl program
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |