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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Wed, 18 Jul 2007, Julian Phillips wrote:
> 
> Is git working internally in TZ=UTC?

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@xxxxxxxxx> 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@xxxxxxxxx>
	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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux