[fpc-pascal] DateTimeToUnix bug ?
Jonas Maebe
jonas.maebe at elis.ugent.be
Wed Jul 15 11:43:53 CEST 2009
On 15 Jul 2009, at 11:06, Koenraad Lelong wrote:
> I have a linux application where I use DatetimeToUnix. I think it
> contains a bug.
> Every minute I put a sample in an rrddb (rrdtool). When I dump the
> rrddb, the time of the samples is 2 hours in the future. Those 2
> hours happen to be the time-zone difference, between UTC and CEST.
DatetimeToUnix is defined as returning the "Unix epoch time
corresponding to AValue". So by definition it does not perform any
time zone adjustments (which is logical, since there is no information
regarding what time zone the input value is related to). It's the same
in Delphi (just google for DatetimeToUnix+timezone
If you want "now" using the local time zone, use sysutils.getlocaltime
instead.
Jonas
More information about the fpc-pascal
mailing list