|
From: | Xypron |
Subject: | Re: [Help-glpk] Time conversion functions |
Date: | Mon, 24 Nov 2008 23:42:17 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.18) Gecko/20081030 SeaMonkey/1.1.13 |
Hello Andrew,
I added the function time(), which returns the number of seconds elapsed since 1970-01-01 00:00:00 in the local timezone. (I decided to name this function 'time', not 'now', because 'time' is its historical name.) As I explained earlier, if one needs to deal with UTC, he may simply add/subtract the time offset (defined somewhere in the model) to/from the value returned by time().
The offset between UTC and local time is not a constant due to day light saving time.
In German local time there are only 11 hours from 00:00 on the last sunday in march to 12:00 on the same day. There are 13 hours from 00:00 to 12:00 on the last sunday in
october. In UTC time from 00:00 to 12:00 there are always 12 hours. How would you express Oct 26, 2008 02:30a (summer time) and Oct 26, 2008 02:30b (winter time) which are 60 minutes apart in GLPK if we used local time?When dealing with models that span different time zones - as is often the case in
scheduling - working in UTC is the only way to write consistent models. I have colleagues in India and the US. How could we ever use the same model if it was in local time? Hence I want to have my models in UTC.We should keep local time out of GLPK models. All numerics representing time should be in UTC. This will guarantee that all users will get the same result for a model
file at the same time.Hence time() should return the current UTC time. Please, replace localtime by gmtime in
function time(). If a user has data in a local time this should be handled in the str2time()(and possibly in time2str). This is why I ask for code '%z' being added to str2time.
Best regards Xypron
[Prev in Thread] | Current Thread | [Next in Thread] |