From: Christos Zoulas Date: Tue, 13 Dec 2011 13:48:41 +0000 (+0000) Subject: rdays is off by one. (Daniel Gillen) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=36cf30c2d1c06a6f5dbef2e8418b230ef02aa93e;p=file rdays is off by one. (Daniel Gillen) --- diff --git a/src/cdf_time.c b/src/cdf_time.c index ee04fb67..5061b46c 100644 --- a/src/cdf_time.c +++ b/src/cdf_time.c @@ -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 @@ -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;