Dates UTC + offset is non meaningful...?

Jason Harris jason at jasonfharris.com
Mon Nov 15 11:39:56 CST 2010


On Nov 15, 2010, at 6:19 PM, Benoit Boissinot wrote:

> On Mon, Nov 15, 2010 at 6:05 PM, Jason Harris <jason at jasonfharris.com> wrote:
>> 
>> On Nov 15, 2010, at 3:38 PM, Matt Mackall wrote:
>>> 
>>> The above timestamp is (local time, offset from UTC)
>> 
>> Yeah... the question was not about isodate format which is normally something like
>> YYYY-MM-DD hh:mm:ss + offset. Its clear one needs the offset here since my 2pm
>> here is different than your 2pm in the states. Thats why isodates have an offset. All well and good.
>> 
>>> vs Mercurial's (UTC
>>> time, offset from UTC), which means doing absolute comparisons is
>>> slightly easier with Mercurial.
>> 
>> But thats just it, what does UTC_time + offset_from_UTC time mean? I had originally
>> added them together and this is what caused my bug. What purpose does the offset_from_UTC serve?
> 
> You need to know the offset to compute the local time. If you don't
> care about local time, ignore the offset.


You mean to know the local time of the person that did the commit, in eg:

hg log --template "{rev} : {date}\n"
16 : 1289811657.0-3600
15 : 1289780610.0-3600
12 : 1278270662.0-7200
10 : 1274539942.0-7200
9 : 1267843485.0-3600
...

(You surely don't mean your own local time since of course  the computer you are on can do that through a variety of means... For instance if we are talking about the UTC time 1289840215 that I used as an example then python has standard functions which will generate the isodate time see: http://docs.python.org/library/datetime.html)


so you are basically say the above output is equivalent to:


16 : 1289811657.0  (and ohh by the way for your interest only the committer was in a time zone an hour behind GMT)
15 : 1289780610.0  (and ohh by the way for your interest only the committer was in a time zone an hour behind GMT)
12 : 1278270662.0  (and ohh by the way for your interest only the committer was in a time zone two hours behind GMT)
10 : 1274539942.0  (and ohh by the way for your interest only the committer was in a time zone two hours behind GMT)
9 : 1267843485.0   (and ohh by the way for your interest only the committer was in a time zone an hour behind GMT)

Ie you don't need the offset for any real purpose whatsoever? Or is that offset used in some other meaningful way?

Thanks,
   Jas


More information about the Mercurial-devel mailing list