Dates UTC + offset is non meaningful...?

Jason Harris jason at jasonfharris.com
Mon Nov 15 11:58:37 CST 2010


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

> On Mon, Nov 15, 2010 at 6:39 PM, Jason Harris <jason at jasonfharris.com> wrote:
>> 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:
>>>>> 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
>> ...
>> 
> 
> Correct.
> 
>> so you are basically saying 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?
> 
> Well, you might want to display the date in a format that shows the
> timezone of the committer, that's a "real" purpose.

Ahh... so that form of UTC+timezone is really because Mercurial wants to *additionally* record the timezone of the committer as more meta-data on the changeset, rather than being integral to any actual computations to do with time.

So ok. I get it now.  Thanks!

Cheers,
  Jas



More information about the Mercurial-devel mailing list