[PLUG] one more comment on date and mktime() results

Russell Senior russell at personaltelco.net
Wed Jan 27 08:01:01 UTC 2016


>>>>> "logical" == logical american <website.reader3 at gmail.com> writes:

logical> One more important thing which I wish to point out, the problem
logical> with the 12:07:01 pm November 18, 1883 time is NOT occurring
logical> with the date command from the command line prompt.  I would
logical> have thought that date and mktime would match, in their results
logical> for any selected date.  But apparently they don't, and I got
logical> lucky in finding the first date that they differ (for Pacific
logical> Timezone anyways).

russell at husum:~$ TZ=PST8PDT ./mktime-discrepancy 
sizeof(time_t) = 8
first struct tm object dump: 1 7 12 18 10 -18 6 321 0 -28800 PST
second struct tm object dump: 2 7 12 18 10 -18 6 321 0 -28800 PST
First time tick: -2749175579 Second time tick: -2749175578 Difference: -1 secs.  Should be -1 seconds instead.
Is this discrepancy due to the 7 min 2 sec difference between PST and
Local Mean Time (Solar Time) ?
russell at husum:~$ ./mktime-discrepancy 
sizeof(time_t) = 8
first struct tm object dump: 1 7 12 18 10 -18 6 321 0 -28378 LMT
second struct tm object dump: 2 7 12 18 10 -18 6 321 0 -28378 LMT
First time tick: -2749176001 Second time tick: -2749176000 Difference: -1 secs.  Should be -1 seconds instead.
Is this discrepancy due to the 7 min 2 sec difference between PST and
Local Mean Time (Solar Time) ?

With and without TZ=PST8PDT.  Note the timezones and that I changed the
year to -18 for kicks.


-- 
Russell Senior, President
russell at personaltelco.net



More information about the PLUG mailing list