New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
strftime time zone bug #4518
Comments
From spencer@zanshin.comThe workaround for NETaa14816 contained in ext/POSIX/POSIX.xs introduces I have a patch which fixes the problem, at least for our configuration. First, a sample script which demonstrates the problem: #!/usr/bin/perl use strict; my $t = 1003803105; # approx. 7:12 PM on Oct. 22, 2001, PDT print_stuff($t); # now add 10 days, which takes us into PST print_stuff($t+864000); sub print_stuff Using 5.6.0 on RedHat 6.2, version 2.2.16 of the kernel (also 10/22/2001 19:11:45 DST: 1 11/01/2001 18:11:45 DST: 0 As you can see, for the second date, even though $isdst == 0, %Z and %z I've attached my patch (diff against 5.6.0) so that Outlook won't mangle the Obviously the patch depends on the correct value of isdst being passed in 10/22/2001 19:11:45 DST: 1 11/01/2001 18:11:45 DST: 0 |
From spencer@zanshin.comInline Patch--- ext/POSIX/POSIX.xs.orig Mon Oct 22 19:04:43 2001
+++ ext/POSIX/POSIX.xs Mon Oct 22 19:08:03 2001
@@ -320,15 +320,17 @@
#ifdef STRUCT_TM_HASZONE
static void
-init_tm(struct tm *ptm) /* see mktime, strftime and asctime */
+init_tm(struct tm *ptm, int isdst) /* see mktime, strftime and asctime */
{
Time_t now;
(void)time(&now);
Copy(localtime(&now), ptm, 1, struct tm);
+ ptm->tm_zone = tzname[isdst];
+ ptm->tm_gmtoff = isdst * 3600 - timezone;
}
#else
-# define init_tm(ptm)
+# define init_tm(ptm, isdst)
#endif
/*
@@ -3749,7 +3751,7 @@
CODE:
{
struct tm mytm;
- init_tm(&mytm); /* XXX workaround - see init_tm() above */
+ init_tm(&mytm, isdst); /* XXX workaround - see init_tm() above */
mytm.tm_sec = sec;
mytm.tm_min = min;
mytm.tm_hour = hour;
@@ -3803,7 +3805,7 @@
CODE:
{
struct tm mytm;
- init_tm(&mytm); /* XXX workaround - see init_tm() above */
+ init_tm(&mytm, isdst); /* XXX workaround - see init_tm() above */
mytm.tm_sec = sec;
mytm.tm_min = min;
mytm.tm_hour = hour;
@@ -3835,7 +3837,7 @@
char tmpbuf[128];
struct tm mytm;
int len;
- init_tm(&mytm); /* XXX workaround - see init_tm() above */
+ init_tm(&mytm, isdst); /* XXX workaround - see init_tm() above */
mytm.tm_sec = sec;
mytm.tm_min = min;
mytm.tm_hour = hour; |
From dlux@dlux.huThis bug is still exists in 5.8.0. The proposed solution is good for BSD I suppose to bzero the mytm structure, it is more acceptable than the Other solution would be to check the linux time.h header and check what |
From dlux@dlux.huEvery bug needs a test case, so I attached one to avoid this problem |
From dlux@dlux.hu[dlux - Sat Dec 14 04:52:44 2002]:
Oops. It is buggy. I forgot one line from the beginning Here is the file again. |
From @smpeters
This appears to have been implemented with change 18267. |
@smpeters - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#7835 (status was 'resolved')
Searchable as RT7835$
The text was updated successfully, but these errors were encountered: