Dates UTC + offset is non meaningful...?
Jason Harris
jason at jasonfharris.com
Mon Nov 15 11:05:59 CST 2010
On Nov 15, 2010, at 3:38 PM, Matt Mackall wrote:
> On Mon, 2010-11-15 at 12:25 +0100, Jason Harris wrote:
>> Hi All,
>>
>> I just want to check if I am missing groking something about the dates mercurial is reporting.
>>
>> In looking at the hg documentation on date times and times it says:
>>
>> hgdate Date. Returns the date as a pair of numbers: "1157407993 25200"
>> (Unix timestamp, timezone offset).
>>
>> But what is the timezone offset for?
>
> Ever get an email? Mine looks like this:
Nope I have never in my life received an email... Not once... Not even this one...
> From: Jason Harris <jason at jasonfharris.com>
> To: Mercurial Devel <mercurial-devel at selenic.com>
> Subject: Dates UTC + offset is non meaningful...?
> Date: Mon, 15 Nov 2010 12:25:05 +0100
>
> My email client tells me that you sent your email about lunch time
> wherever it is that you are, which tells me more than 5am my time.
> For instance, it tells me I'm not likely to get a response at 6pm my
> time.
>
> 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?
Ie if I log into a machine in the states and execute:
[jasonh at usmachine ~] > date +%s
1289840215
[jasonh at usmachine ~] > date
Mon Nov 15 10:57:06 CST 2010
But if I do the same on my local machine here I get:
[Bolt:~] ⌘ date +%s
1289840215
[Bolt:~] ⌘ date
Mon Nov 15 17:57:03 CET 2010
Ie that time 1289840215 fixes the time in the whole world. One didn't need to know
its 10:57 with respect to CST, or 10:57 with respect to CET, etc.
Thus again. What purpose does UTC + offset_from_UTC serve?
Ie couldn't the output of:
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
...
equivalently be:
16 : 1289811657.0
15 : 1289780610.0
12 : 1278270662.0
10 : 1274539942.0
9 : 1267843485.0
What purpose does the -3600, -7200 serve in the above?
Thanks,
Jas
More information about the Mercurial-devel
mailing list