2011/9/25 Sven Barth <[email protected]>: > 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...
SysUtils.Now is local not UTC. DateTimeToUnix cannot distinguish if passed parameter is UTC or local. There would need to be NowToUnix() which takes Now in UTC and converts to Unix Time. $ date +"%z %Z" +0100 CET $ LC_ALL=C; date -s"1970-01-01 00:00:00 +0000" -R; echo -n "Date: "; date +%s; /tmp/project1 Thu, 01 Jan 1970 01:00:00 +0100 Date: 0 DateTimeToUnix(Now): 3600 -- cobines -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
