summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-19 16:10:37 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-19 16:10:37 +0000
commitd0e85dcee87ca227273fd34b9a90f68c96b3d833 (patch)
treeb1bc22b143615bbeb4f320446ed928ab0adffc48 /ext
parentc1d22f6b609261e5abd7381bd017773c7ae58346 (diff)
downloadperl-d0e85dcee87ca227273fd34b9a90f68c96b3d833.tar.gz
POSIX::strftime gets the date wrong (from John Tobey
<jtobey@epsilondev.com>) p4raw-id: //depot/perl@5145
Diffstat (limited to 'ext')
-rw-r--r--ext/POSIX/POSIX.xs10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index af43c40714..3a523d1d07 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -510,8 +510,14 @@ mini_mktime(struct tm *ptm)
}
}
ptm->tm_year = year - 1900;
- ptm->tm_mon = month;
- ptm->tm_mday = yearday;
+ if (yearday) {
+ ptm->tm_mday = yearday;
+ ptm->tm_mon = month;
+ }
+ else {
+ ptm->tm_mday = 31;
+ ptm->tm_mon = month - 1;
+ }
/* re-build yearday based on Jan 1 to get tm_yday */
year--;
yearday = year*DAYS_PER_YEAR + year/4 - year/100 + year/400;