[fpc-pascal] DateTimeToUnix bug ?
Koenraad Lelong
fpascal at brouwerij.homelinux.net
Wed Jul 15 12:52:44 CEST 2009
Jonas Maebe schreef:
>
> 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
Thanks Jonas, but that gives the same result. I found that
fpGetTimeOfDay does the trick.
Regards,
Koenraad.
More information about the fpc-pascal
mailing list