|
From: <HBB...@t-...> - 2007-08-08 09:53:06
|
Ethan Merritt wrote: > /* defines used for timeseries, seconds */ > #define ZERO_YEAR 2000 > #define JAN_FIRST_WDAY 6 /* 1st jan, 2000 is a Saturday (cal 1 2000 on unix) */ > #define SEC_OFFS_SYS 946684800.0 /* zero gnuplot (2000) - zero system (1970) */ > #define YEAR_SEC 31557600.0 /* avg, incl. leap year */ > #define MON_SEC 2629800.0 /* YEAR_SEC / 12 */ > #define WEEK_SEC 604800.0 > #define DAY_SEC 86400.0 > The problem is, these values are not correct so far as I can determine. You determined incorrectly. > The actual mean number of seconds per year according to the > Time Service Dept of the U.S. Naval Observatory is 31556926.0 That's the mean number of seconds of the actual astronomical year. But we're dealing with calendars here, not with astronomy. The average length of a calender year, in the period under consideration (1970 to roughly 2038), is 365.25 days. Multiply that by DAY_SEC and you get exactly those 31557600 seconds found in our YEAR_SEC. > This causes gnuplot's conversion from base year 1970 to 2000 to be > off by about 20220 seconds, which is about 5 1/2 hours. We're not, as can be shown rather easily by looking at the relevant reference tool's output: $ date --date='2000-01-01 00:00:00 UTC' +'%s' 946684800 > A symptom of this is that if you read in time data using the "%s" > timefmt, the time you get is wrong by 5 hours. I'm close to 100% certain that this is not the reason. Time zones are way more probable to cause that. |