aboutsummaryrefslogtreecommitdiff
path: root/contrib/perl5/ext/POSIX/POSIX.xs
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2000-05-11 23:49:13 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2000-05-11 23:49:13 +0000
commit738988c18248d9a0b7ac7298f1f054105bf1feae (patch)
tree876315df0a720f37269cc627b41020c9127fe57f /contrib/perl5/ext/POSIX/POSIX.xs
parent0f32c069d9b14ed4d5b4fedd502465a696ee6615 (diff)
Better fix for strftime/mktime bug, now more compatible since local timezone
name and offset restored for compatibility with standard perl
Notes
Notes: svn path=/head/; revision=60410
Diffstat (limited to 'contrib/perl5/ext/POSIX/POSIX.xs')
-rw-r--r--contrib/perl5/ext/POSIX/POSIX.xs17
1 files changed, 13 insertions, 4 deletions
diff --git a/contrib/perl5/ext/POSIX/POSIX.xs b/contrib/perl5/ext/POSIX/POSIX.xs
index 093cc9957797..2066b4697236 100644
--- a/contrib/perl5/ext/POSIX/POSIX.xs
+++ b/contrib/perl5/ext/POSIX/POSIX.xs
@@ -3620,9 +3620,12 @@ strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
char tmpbuf[128];
struct tm mytm;
int len;
-#ifndef __FreeBSD__
- init_tm(&mytm); /* XXX workaround - see init_tm() above */
+#ifdef __FreeBSD__
+ long sgmtoff;
+ int sisdst;
+ char *szone;
#endif
+ init_tm(&mytm); /* XXX workaround - see init_tm() above */
mytm.tm_sec = sec;
mytm.tm_min = min;
mytm.tm_hour = hour;
@@ -3633,8 +3636,14 @@ strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
mytm.tm_yday = yday;
mytm.tm_isdst = isdst;
#ifdef __FreeBSD__
- mytm.tm_gmtoff = 0;
- mytm.tm_zone = "???";
+ sgmtoff = mytm.tm_gmtoff;
+ sisdst = mytm.tm_isdst;
+ szone = mytm.tm_zone;
+ /* to prevent mess with shifted hours/days/etc. */
+ (void) timegm(&mytm);
+ mytm.tm_gmtoff = sgmtoff;
+ mytm.tm_isdst = sisdst;
+ mytm.tm_zone = szone;
#else
(void) mktime(&mytm);
#endif