{"thread":{"id":"9091","subject":"Wrong time in git-log when using right/ timezone","startedAt":"2007-07-18T15:36:14Z","lastAt":"2007-07-25T20:03:44Z","messageCount":8,"participants":["Peter Hartlich","Linus Torvalds","Julian Phillips","Alex Riesen","Junio C Hamano","Jan Hudec"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"47742","messageId":"20070718153614.GA28815@hartlich.com","threadId":"9091","inReplyTo":null,"subject":"Wrong time in git-log when using right/ timezone","fromName":"Peter Hartlich","fromEmail":"wwsgj@hartlich.com","sentAt":"2007-07-18T15:36:14Z","receivedAt":"2007-07-18T15:36:14Z","isPatch":false,"sender":{"key":"wwsgj@hartlich.com","avatar":null},"body":"Hi,\n\nMy timezone is set to right/Europe/Berlin. git-log 1.5.2.2 gives me output\nsuch as:\n\n| Date:   Wed Jul 18 16:17:31 2007 +0159\n\nNote the timezone, which should be +0200.\n\nI'm using tzcode/tzdata 2007f from <ftp://elsie.nci.nih.gov/pub/>. A small\ntest script is attached.\n\nRegards,\nPeter Hartlich\n"},{"id":"47746","messageId":"20070718160424.GA29619@hartlich.com","threadId":"9091","inReplyTo":"20070718153614.GA28815@hartlich.com","subject":"Re: Wrong time in git-log when using right/ timezone","fromName":"Peter Hartlich","fromEmail":"wwsgj@hartlich.com","sentAt":"2007-07-18T16:04:24Z","receivedAt":"2007-07-18T16:04:24Z","isPatch":false,"sender":{"key":"wwsgj@hartlich.com","avatar":null},"body":"I wrote:\n\n> git-log 1.5.2.2 gives me output such as:\n\nForgot to add that the bug is present in the current dev version.\n\nRegards,\nPeter Hartlich\n"},{"id":"47753","messageId":"alpine.LFD.0.999.0707180948080.27353@woody.linux-foundation.org","threadId":"9091","inReplyTo":"20070718153614.GA28815@hartlich.com","subject":"Re: Wrong time in git-log when using right/ timezone","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-07-18T17:01:31Z","receivedAt":"2007-07-18T17:01:31Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 18 Jul 2007, Peter Hartlich wrote:\n> \n> My timezone is set to right/Europe/Berlin. git-log 1.5.2.2 gives me \n> output such as:\n> \n> | Date:   Wed Jul 18 16:17:31 2007 +0159\n> \n> Note the timezone, which should be +0200.\n\nWow. I just tried:\n\n\tgit show --raw --date=local\n\nwith TZ=CET and TZ=right/Europe/Berlin respectively.\n\nTrippy.\n\nI get:\n\n\tcommit 9dfdf14b3805e89aa2782458bda15b3dfae24c09\n\tAuthor: Junio C Hamano <gitster@pobox.com>\n\tDate:   Mon Jul 16 01:41:17 2007\n\nfor the CET case, but for right/Europe/Berlin I get:\n\n\tcommit 9dfdf14b3805e89aa2782458bda15b3dfae24c09\n\tAuthor: Junio C Hamano <gitster@pobox.com>\n\tDate:   Mon Jul 16 01:39:54 2007\n\nie apparently Berlin is in a timezone of its own that is roughly one \nminute and 23 seconds away from CET.\n\nWhat the *heck*?\n\nI really don't think this is git that is confused: I get the exact same \nthing with \"date\" too:\n\n\t[torvalds@woody git]$ TZ=right/Europe/Berlin date ; TZ=CET date\n\tWed Jul 18 18:52:25 CEST 2007\n\tWed Jul 18 18:52:48 CEST 2007\n\nso it really *is* the tzdata that says that Berlin is not +0200, and it's \nnot even +0159, it's something really strange with fractional minutes away \nfrom UTC.\n\nWhat can I say? \"Those wacky Germans - they have a wonderful sense of \nhumor\"?\n\n\t\t\tLinus\n"},{"id":"47757","messageId":"Pine.LNX.4.64.0707181849060.1544@reaper.quantumfyre.co.uk","threadId":"9091","inReplyTo":"alpine.LFD.0.999.0707180948080.27353@woody.linux-foundation.org","subject":"Re: Wrong time in git-log when using right/ timezone","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2007-07-18T17:55:57Z","receivedAt":"2007-07-18T17:55:57Z","isPatch":false,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Wed, 18 Jul 2007, Linus Torvalds wrote:\n\n> ie apparently Berlin is in a timezone of its own that is roughly one\n> minute and 23 seconds away from CET.\n>\n> What the *heck*?\n>\n> I really don't think this is git that is confused: I get the exact same\n> thing with \"date\" too:\n>\n> \t[torvalds@woody git]$ TZ=right/Europe/Berlin date ; TZ=CET date\n> \tWed Jul 18 18:52:25 CEST 2007\n> \tWed Jul 18 18:52:48 CEST 2007\n>\n> so it really *is* the tzdata that says that Berlin is not +0200, and it's\n> not even +0159, it's something really strange with fractional minutes away\n> from UTC.\n\nWell ... not if you compare right/Europe/Berlin vs right/CET\n\njp3@neutron: ~>TZ=right/CET date '+%H:%M:%S %z'; TZ=right/Europe/Berlin \ndate '+%H:%M:%S %z'\n19:49:45 +0200\n19:49:45 +0200\n\nbut, I suspect that the following is the underlying cause of the problem?\n\njp3@neutron: ~>TZ=right/UTC date '+%H:%M:%S %z'; TZ=UTC date '+%H:%M:%S \n%z'\n17:51:32 +0000\n17:51:55 +0000\n\nIs git working internally in TZ=UTC?\n\n-- \nJulian\n\n  ---\n\nHomer:\tWe always have one good kid and one lousy kid.  Why can't both\n \tour kids be good?\n\nMarge:\tWe have three kids, Homer.\n\n \t\t   Separate Vacations\n"},{"id":"47760","messageId":"alpine.LFD.0.999.0707181106280.27353@woody.linux-foundation.org","threadId":"9091","inReplyTo":"Pine.LNX.4.64.0707181849060.1544@reaper.quantumfyre.co.uk","subject":"Re: Wrong time in git-log when using right/ timezone","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-07-18T18:19:46Z","receivedAt":"2007-07-18T18:19:46Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 18 Jul 2007, Julian Phillips wrote:\n> \n> Is git working internally in TZ=UTC?\n\nYes.\n\nThe TZ in git terms has no meaning what-so-ever, it's purely for \n\"decoration\", so that people can see what the local time was. But a git \ntime really *is* the UTC seconds-since-1970, and the timezone is saved so \nthat it can be shown, but not for anything else.\n\nSo git always stores times in UTC, but then when showing them, it shows \nthem as relative to the timezone they were done in.\n\nYou can see this by doing\n\n\tgit cat-file commit HEAD\n\nwhich shows something like\n\n\tauthor Junio C Hamano <gitster@pobox.com> 1184542877 -0700\n\nand that \"1184542877\" is literally the time in UTC, and is the only thing \nthat git really tracks. The \"-0700\" is informational, so that when you \nshow it as a log entry, it shows as\n\n\tAuthor: Junio C Hamano <gitster@pobox.com>\n\tDate:   Sun Jul 15 16:41:17 2007 -0700\n\neven though that \"1184542877\" really means \"Sun Jul 15 23:41:17 2007\".\n\nSo git never actually saves anything at all in local time, it just tries \nto show things in whatever the local time was for the person who did \nsomething (unless you use the \"--date=local\" option, in which case it \nignores the saved TZ, and uses your _current_ TZ to show the date)\n\nUnless we have a bug, of course.\n\n\t\t\tLinus\n"},{"id":"47768","messageId":"20070718202915.GA29505@steel.home","threadId":"9091","inReplyTo":"alpine.LFD.0.999.0707180948080.27353@woody.linux-foundation.org","subject":"Re: Wrong time in git-log when using right/ timezone","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-07-18T20:29:15Z","receivedAt":"2007-07-18T20:29:15Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Linus Torvalds, Wed, Jul 18, 2007 19:01:31 +0200:\n> I get:\n> \n> \tcommit 9dfdf14b3805e89aa2782458bda15b3dfae24c09\n> \tAuthor: Junio C Hamano <gitster@pobox.com>\n> \tDate:   Mon Jul 16 01:41:17 2007\n> \n> for the CET case, but for right/Europe/Berlin I get:\n> \n> \tcommit 9dfdf14b3805e89aa2782458bda15b3dfae24c09\n> \tAuthor: Junio C Hamano <gitster@pobox.com>\n> \tDate:   Mon Jul 16 01:39:54 2007\n> \n> ie apparently Berlin is in a timezone of its own that is roughly one \n> minute and 23 seconds away from CET.\n> \n> What the *heck*?\n> \n\nMaybe the \"right/\" timezones are just a little too right?\n\nhttp://ecos.sourceware.org/ml/libc-alpha/2000-12/msg00068.html\n"},{"id":"47770","messageId":"7vk5sx77me.fsf@assigned-by-dhcp.cox.net","threadId":"9091","inReplyTo":"alpine.LFD.0.999.0707180948080.27353@woody.linux-foundation.org","subject":"Re: Wrong time in git-log when using right/ timezone","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-18T20:57:13Z","receivedAt":"2007-07-18T20:57:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> Wow. I just tried:\n>\n> \tgit show --raw --date=local\n>\n> with TZ=CET and TZ=right/Europe/Berlin respectively.\n> ...\n> ie apparently Berlin is in a timezone of its own that is roughly one \n> minute and 23 seconds away from CET.\n>\n> What the *heck*?\n>\n> I really don't think this is git that is confused: I get the exact same \n> thing with \"date\" too:\n>\n> \t[torvalds@woody git]$ TZ=right/Europe/Berlin date ; TZ=CET date\n> \tWed Jul 18 18:52:25 CEST 2007\n> \tWed Jul 18 18:52:48 CEST 2007\n>\n> so it really *is* the tzdata that says that Berlin is not +0200, and it's \n> not even +0159, it's something really strange with fractional minutes away \n> from UTC.\n>\n> What can I say? \"Those wacky Germans - they have a wonderful sense of \n> humor\"?\n\nNo, I do not think the wackiness is from Germans.\n\nUsing right/ perhaps without realizing the differences between\nTZ=right/Europe/Berlin and TZ=Europe/Berlin is probably the\nsource of confusion.\n\nI do not offhand know what role \"leap second adjustment\" should\nplay in the context of converting from Unix time we store in git\ncommit objects to human readable role.  As far as I understand,\nthe returned timestamp from time(2), which we record in commit\nobjects, is already \"leap second adjusted\".\n"},{"id":"48582","messageId":"20070725200344.GA3808@efreet.light.src","threadId":"9091","inReplyTo":"7vk5sx77me.fsf@assigned-by-dhcp.cox.net","subject":"Re: Wrong time in git-log when using right/ timezone","fromName":"Jan Hudec","fromEmail":"bulb@ucw.cz","sentAt":"2007-07-25T20:03:44Z","receivedAt":"2007-07-25T20:03:44Z","isPatch":false,"sender":{"key":"bulb@ucw.cz","avatar":null},"body":"On Wed, Jul 18, 2007 at 13:57:13 -0700, Junio C Hamano wrote:\n> No, I do not think the wackiness is from Germans.\n> \n> Using right/ perhaps without realizing the differences between\n> TZ=right/Europe/Berlin and TZ=Europe/Berlin is probably the\n> source of confusion.\n> \n> I do not offhand know what role \"leap second adjustment\" should\n> play in the context of converting from Unix time we store in git\n> commit objects to human readable role.  As far as I understand,\n> the returned timestamp from time(2), which we record in commit\n> objects, is already \"leap second adjusted\".\n\nI can attempt a brief explanation if anyone is (still) interested.\n\nLeap seconds are added iregularly, because Earth rotation is slightly\nirregular. Therefore some time calculations require lookup into a table of\nleap seconds:\n - If you include leap seconds in the timer, converting to date+time does,\n   while time difference does not. This is what the right/ timezones use.\n - If you exclude leap seconds from the timer, time difference does, but\n   converting to date+time does not. This is what the normal timezones use.\n\nObviously, the two approaches don't play well together. POSIX chose the\nlater, likely because it's much more common to want to know date+time for\nsome moment, than to calculate several year long time interval with second\nprecision (because so far there have been at most 2 seconds difference per\nyear).\n\nNote, that the former approach allows you to talk about time 65936023 seconds\nfrom now, but not what date and time it will be, while the later allows you\nto talk about 2437-11-05 16:12:05, but not how many seconds are left until\nthan.\n\n-- \n\t\t\t\t\t\t Jan 'Bulb' Hudec <bulb@ucw.cz>\n"}]}