Re: Wrong time in git-log when using right/ timezone

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Julian Phillips <julian@...>
Cc: Peter Hartlich <wwsgj@...>, <git@...>
Date: Wednesday, July 18, 2007 - 2:19 pm

On Wed, 18 Jul 2007, Julian Phillips wrote:

Yes.

The TZ in git terms has no meaning what-so-ever, it's purely for 
"decoration", so that people can see what the local time was. But a git 
time really *is* the UTC seconds-since-1970, and the timezone is saved so 
that it can be shown, but not for anything else.

So git always stores times in UTC, but then when showing them, it shows 
them as relative to the timezone they were done in.

You can see this by doing

	git cat-file commit HEAD

which shows something like

	author Junio C Hamano <gitster@pobox.com> 1184542877 -0700

and that "1184542877" is literally the time in UTC, and is the only thing 
that git really tracks. The "-0700" is informational, so that when you 
show it as a log entry, it shows as

	Author: Junio C Hamano <gitster@pobox.com>
	Date:   Sun Jul 15 16:41:17 2007 -0700

even though that "1184542877" really means "Sun Jul 15 23:41:17 2007".

So git never actually saves anything at all in local time, it just tries 
to show things in whatever the local time was for the person who did 
something (unless you use the "--date=local" option, in which case it 
ignores the saved TZ, and uses your _current_ TZ to show the date)

Unless we have a bug, of course.

			Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Wrong time in git-log when using right/ timezone, Peter Hartlich, (Wed Jul 18, 11:36 am)
Re: Wrong time in git-log when using right/ timezone, Linus Torvalds, (Wed Jul 18, 1:01 pm)
Re: Wrong time in git-log when using right/ timezone, Junio C Hamano, (Wed Jul 18, 4:57 pm)
Re: Wrong time in git-log when using right/ timezone, Alex Riesen, (Wed Jul 18, 4:29 pm)
Re: Wrong time in git-log when using right/ timezone, Julian Phillips, (Wed Jul 18, 1:55 pm)
Re: Wrong time in git-log when using right/ timezone, Linus Torvalds, (Wed Jul 18, 2:19 pm)
Re: Wrong time in git-log when using right/ timezone, Peter Hartlich, (Wed Jul 18, 12:04 pm)