On 25.09.2011 20:12, silvioprog wrote:
2011/9/25 Sven Barth<[email protected]>:
I personally suggest using "DateTimeToUnix" which is located in unit
"dateutils". It converts a TDateTime to an Unix timestamp (which is the
count of milliseconds since 1/1/1970). See also here:
http://www.freepascal.org/docs-html/rtl/dateutils/datetimetounix.html
Regards,
Sven
I know DateTimeToUnix, but:
getTime: 1317006621430
DateTimeToUnix: 1316963421
Hmm... it seems to only return the seconds since that date and according
to Wikipedia ( http://en.wikipedia.org/wiki/Unix_time ) this is correct.
So it would not be completely incorrect to multiply the returned time by
1000.
Regarding the offset:
For me the command "date +%s" returns
1316975223
while a program writing the result of "DateTimeToUnix(Now)" returns
1316982419
The difference between the two is
7196
In minutes:
~119
Which means around 2 hours. This matches my timezone. So one of the two
does respect the timezone while the other does not. I don't know which
is the correct solution though; perhaps this is mentioned in the
Wikipedia article...
Regards,
Sven
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus