summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-11-11 20:03:19 +0000
committerJeremy Allison <jra@samba.org>1998-11-11 20:03:19 +0000
commit49d5a679a79fc9fdc7e3de644a8bb4343b6d8939 (patch)
tree97b4b3d0940f640e6f07d01833e847355dbec70c
parent60a91a1dca12e675e4498062f33ed773ddd5600a (diff)
downloadsamba-49d5a679a79fc9fdc7e3de644a8bb4343b6d8939.tar.gz
samba-49d5a679a79fc9fdc7e3de644a8bb4343b6d8939.tar.bz2
samba-49d5a679a79fc9fdc7e3de644a8bb4343b6d8939.zip
Fix from richard.kettlewell@kewill.com for leapyear bugs.
Jeremy. (This used to be commit 751856a09d4fa112ce2fedd963b42ae5f63c89c1)
-rw-r--r--source3/lib/replace.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source3/lib/replace.c b/source3/lib/replace.c
index 56f6b9c637..b0adb72fd2 100644
--- a/source3/lib/replace.c
+++ b/source3/lib/replace.c
@@ -48,7 +48,9 @@ ftruncate for operating systems that don't have it
/*******************************************************************
a mktime() replacement for those who don't have it - contributed by
C.A. Lademann <cal@zls.com>
+Corrections by richard.kettlewell@kewill.com
********************************************************************/
+
#define MINUTE 60
#define HOUR 60*MINUTE
#define DAY 24*HOUR
@@ -57,14 +59,16 @@ C.A. Lademann <cal@zls.com>
{
struct tm *u;
time_t epoch = 0;
+ int n;
int mon [] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
y, m, i;
if(t->tm_year < 70)
return((time_t)-1);
+ n = t->tm_year + 1900 - 1;
epoch = (t->tm_year - 70) * YEAR +
- (t->tm_year / 4 - 70 / 4 - t->tm_year / 100) * DAY;
+ ((n / 4 - n / 100 + n / 400) - (1969 / 4 - 1969 / 100 + 1969 / 400)) * DAY;
y = t->tm_year;
m = 0;