git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-fast-import

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Feb 7, 2007, 02:50 UTC
Message-ID
<Pine.LNX.4.64.0702061832020.8424@woody.linux-foundation.org>
In-Reply-To
<200702070117.l171HGxr023213@laptop13.inf.utfsm.cl>
On Tue, 6 Feb 2007, Horst H. von Brand wrote:
Show 15 quoted lines
>
> Shawn O. Pearce <spearce@spearce.org> wrote:
> 
> [...]
> 
> > What about this language?
> > 
> > 	The time of the change is specified by `<time>` as the number of
> > 	seconds since the UNIX epoc (midnight, Jan 1, 1970, UTC) and is
> > 	written in base-10 notation using US-ASCII digits.  The committer's
> > 	timezone is specified by `<tz>` as a positive or negative offset
> > 	from UTC.  For example EST (which is typically 5 hours behind GMT)
> > 	would be expressed in `<tz>` by ``-0500'' while GMT is ``+0000''.
> 
> That is /not/ a timezone! Maybe an offset from UTC.
Btw, one thing that might be a good idea to document very clearly:
 - in the native git format, the offset from UTC has *nothing* to do with 
   the actual time itself. The time in native git is always in UTC, and 
   the offset from UTC does not change "time" - it's purely there to tell 
   in which timezone the event happened.
   So 12345678 +0000 and 12345678 -0700 are *exactly*the*same*date*, 
   except event one happened in UTC, and the other happened in UTC-7.
 - in rfc2822 format, the offset from UTC actually *changes* the date. The 
   date "Oct 12, 2006 20:00:00" will be two _different_ times when you say 
   it is in PST or in UTC.

And yes, for all I know we might get this wrong inside git too. It's easy to get confused, because they really do mean different things.

For an example of this, do
	make test-date

in git (which parses the argument using the "exact date" and "approxidate" versions respectively, and the exact date parsing will give the internal git representation on the first line in the middle column), and then:

	./test-date "1234567890 -0800"
	./test-date "1234567890 +0000"
and then try
	./test-date "Fri Feb 13 15:31:30 2009 PST"
	./test-date "Fri Feb 13 15:31:30 2009 UTC"

and notice how the first two (numeric) dates that differ in UTC offset will still return the exact same seconds since the epoch:

	1234567890 -0800
	1234567890 +0000

but the second example (with a rfc2822-like date), will show how the seconds-since-epoch changes, and gives:

	1234567890 -0800
	1234539090 +0000
respectively for those two dates.

Logical? It actually is, but you have to understand how git represents date to see the logic. To git, the "timezone" is really totally irrelevant. It doesn't really affect the "date" at all. At most, it affects how you _print_ the date, and you can tell what timezone the computer was set to when the commit was made.

And yes, I would not be at all surprised if we had some bug here where we got it wrong occasionally.

		Linus
Previous: Horst H. von BrandNext: Shawn O. Pearce
Message 34 of 49 in “git-fast-import”
  1. Shawn O. PearceFeb 6, 2007
  2. Nicolas PitreFeb 6, 2007
  3. Nicolas PitreFeb 6, 2007
  4. Shawn O. PearceFeb 6, 2007
  5. Linus TorvaldsFeb 6, 2007
  6. Shawn O. PearceFeb 6, 2007
  7. Linus TorvaldsFeb 6, 2007
  8. Nicolas PitreFeb 6, 2007
  9. Shawn O. PearceFeb 6, 2007
  10. Nicolas PitreFeb 6, 2007
  11. Shawn O. PearceFeb 6, 2007
  12. Nicolas PitreFeb 6, 2007
  13. David WoodhouseFeb 7, 2007
  14. Aneesh Kumar K.VFeb 6, 2007
  15. Shawn O. PearceFeb 6, 2007
  16. Daniel BarkalowFeb 7, 2007
  17. Karl HasselströmFeb 7, 2007
  18. Johannes SchindelinFeb 7, 2007
  19. Shawn O. PearceFeb 7, 2007
  20. Johannes SchindelinFeb 7, 2007
  21. Shawn O. PearceFeb 8, 2007
  22. Linus TorvaldsFeb 8, 2007
  23. Shawn O. PearceFeb 8, 2007
  24. Karl HasselströmFeb 9, 2007
  25. Linus TorvaldsFeb 9, 2007
  26. Raimund BauerFeb 7, 2007
  27. David WoodhouseFeb 7, 2007
  28. Andy ParkinsFeb 6, 2007
  29. Shawn O. PearceFeb 6, 2007
  30. Linus TorvaldsFeb 6, 2007
  31. Shawn O. PearceFeb 6, 2007
  32. Linus TorvaldsFeb 6, 2007
  33. Horst H. von BrandFeb 7, 2007
  34. Linus TorvaldsFeb 7, 2007
  35. Shawn O. PearceFeb 7, 2007
  36. Karl HasselströmFeb 7, 2007
  37. Horst H. von BrandFeb 7, 2007
  38. Jakub NarebskiFeb 7, 2007
  39. Linus TorvaldsFeb 7, 2007
  40. Johannes SchindelinFeb 8, 2007
  41. Shawn O. PearceFeb 7, 2007
  42. Daniel BarkalowFeb 7, 2007
  43. Jakub NarebskiFeb 6, 2007
  44. Shawn O. PearceFeb 6, 2007
  45. Jakub NarebskiFeb 6, 2007
  46. Shawn O. PearceFeb 6, 2007
  47. Alex RiesenFeb 6, 2007
  48. Shawn O. PearceFeb 6, 2007
  49. Alex RiesenFeb 6, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.