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

Re: git.git object database at kernel.org?

From
HAH. Peter Anvin <hpa@zytor.com>
Date
Apr 26, 2005, 00:48 UTC
Message-ID
<426D8FDF.5050608@zytor.com>
In-Reply-To
<Pine.LNX.4.58.0504251729080.18901@ppc970.osdl.org>
Linus Torvalds wrote:
Show 18 quoted lines
> 
> On Mon, 25 Apr 2005, H. Peter Anvin wrote:
> 
>>No, mktime() always uses the local time zone.  It's the inverse of 
>>localtime().
> 
> Note that this still doesn't make any sense.
> 
> A true inverse of "localtime()" should still take the GMT offset from
> "struct tm", and it would work fine, assuming that localtime() set that
> offset correctly.
> 
> So _I_ think it's incredibly stupid that mktime() looks at the local 
> timezone. 
> 
> Oh, well.  Not a big issue except for the date conversion, and since there 
> hopefully aren't any old repo's left, we can leave it behind us.
> 

It *is* incredibly stupid, but dates back to the fact that a the GMT offset field in struct tm is a reasonably recent invention, and a lot of old code depended on just stuffing fields in struct tm and calling mktime(); they would leave the offset field uninitialized, as opposed to setting it to some well-defined "I don't know" value.

What totally blows is that if mktime() can't be fixed, that we haven't added mktime_have_offset() or something like that.

Oh well.  If you have the offset, the algorithm is fully arithmetric and 
doesn't rely on the zoneinfo system, so it can be trivially implemented. 
   And again, curl_gettime() does handle the whole string to time_t 
conversion of the common formats.
	-hpa
Previous: Linus TorvaldsNext: Linus Torvalds
Message 5 of 7 in “Re: git.git object database at kernel.org?”
  1. Linus TorvaldsApr 24, 2005
  2. H. Peter AnvinApr 25, 2005
  3. H. Peter AnvinApr 25, 2005
  4. Linus TorvaldsApr 26, 2005
  5. H. Peter AnvinApr 26, 2005
  6. Linus TorvaldsApr 26, 2005
  7. H. Peter AnvinApr 26, 2005

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.