[Lazarus] UnixToDateTime and time zone
waldo kitty
wkitty42 at windstream.net
Fri Sep 17 04:44:57 CEST 2010
On 9/16/2010 18:55, Alberto Narduzzi wrote:
> Dibo,
>
>> Is there a function in FPC that returns me my local UTC offset?
>
> never tested them, thou' have a look at DateTimeToUnix and UnixToDateTime, in
> unit DateUtils
something else to consider is that you should always pass the UTC offset =OR=
always pass time from GMT and then convert to local time...
FWIW: i ran into something kinda similar recently with some perl code... i found
that the perl mktime routine was returning results that were +/- 1 hour
depending on how i was subtracting to find the difference between two unixtime
stamps... it took me a few hours to find that i needed to be using the timelocal
routine instead of mktime and that's all i changed... since then, i've
remembered my history and taken to storing all times as local time converted to
GMT and then converting back to local time when displaying... the main thing
this helps with is the sending of the time data elsewhere and having them get
the proper local time for the activity in their location...
HTH in some small way...
More information about the Lazarus
mailing list