]> granicus.if.org Git - file/commitdiff
rdays is off by one. (Daniel Gillen)
authorChristos Zoulas <christos@zoulas.com>
Tue, 13 Dec 2011 13:48:41 +0000 (13:48 +0000)
committerChristos Zoulas <christos@zoulas.com>
Tue, 13 Dec 2011 13:48:41 +0000 (13:48 +0000)
src/cdf_time.c

index ee04fb671e2cf6e5d1cad77365cbd30154a6ad36..5061b46cd3120af5aa3733bf65690337605a0de2 100644 (file)
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: cdf_time.c,v 1.10 2011/02/10 17:03:16 christos Exp $")
+FILE_RCSID("@(#)$File: cdf_time.c,v 1.11 2011/12/13 13:48:41 christos Exp $")
 #endif
 
 #include <time.h>
@@ -121,7 +121,7 @@ cdf_timestamp_to_timespec(struct timespec *ts, cdf_timestamp_t t)
        tm.tm_year = (int)(CDF_BASE_YEAR + (t / 365));
 
        rdays = cdf_getdays(tm.tm_year);
-       t -= rdays;
+       t -= rdays - 1;
        tm.tm_mday = cdf_getday(tm.tm_year, (int)t);
        tm.tm_mon = cdf_getmonth(tm.tm_year, (int)t);
        tm.tm_wday = 0;