From: David Woodhouse <dwmw2@infradead•org>
To: Russ Allbery <rra@stanford•edu>
Cc: Linus Torvalds <torvalds@osdl•org>, git@vger•kernel.org
Subject: Re: Trying to use AUTHOR_DATE
Date: Sat, 30 Apr 2005 09:02:54 +0100 [thread overview]
Message-ID: <1114848175.24014.35.camel@localhost.localdomain> (raw)
In-Reply-To: <87zmvganq9.fsf@windlord.stanford.edu>
On Fri, 2005-04-29 at 21:32 -0700, Russ Allbery wrote:
> Linus Torvalds <torvalds@osdl•org> writes:
> > It also seems to do so in a particularly stupid way, and David
> > Woodhouses suggestion of just using mktime() on Jan 1st, 1970, seems to
> > be much simpler than what curl does.
>
> Because of daylight savings time, this doesn't actually work. I know from
> personal experience; this is the tactic that I took at first when writing
> INN's date parser and was educated by test failures.
Eww. The time functions we have to play with _really_ suck, don't they?
How about this...
Signed-off-by: David Woodhouse <dwmw2@infradead•org>
commit-tree.c: needs update
Index: commit-tree.c
===================================================================
--- c3aa1e6b53cc59d5fbe261f3f859584904ae3a63/commit-tree.c (mode:100644 sha1:23de13361944ad7ba7c5320cf7cdd04e81842c60)
+++ uncommitted/commit-tree.c (mode:100644)
@@ -213,10 +213,18 @@
if (*(skipfws(p + 5)))
return;
- then = mktime(&tm); /* mktime appears to ignore the GMT offset, stupidly */
+ tm.tm_gmtoff = 0;
+ tm.tm_isdst = -1;
+
+ then = mktime(&tm);
if (then == -1)
return;
+ /* mktime always uses localtime, regardless of the tm_gmtoff field.
+ It does, however, honour 'tm_isdst'; stupidly. Thankfully, it does
+ at least tell us the offset it decided to use, so we can compensate
+ for it */
+ then += tm.tm_gmtoff;
then -= offset;
snprintf(result, maxlen, "%lu %5.5s", then, p);
--
dwmw2
next prev parent reply other threads:[~2005-04-30 7:59 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-30 3:44 Trying to use AUTHOR_DATE Luck, Tony
2005-04-30 3:49 ` H. Peter Anvin
2005-04-30 4:02 ` Linus Torvalds
2005-04-30 4:22 ` Linus Torvalds
2005-04-30 4:32 ` Russ Allbery
2005-04-30 8:02 ` David Woodhouse [this message]
2005-04-30 10:40 ` Edgar Toernig
2005-04-30 18:10 ` Russ Allbery
2005-04-30 20:32 ` Linus Torvalds
2005-04-30 21:59 ` Juliusz Chroboczek
2005-04-30 22:54 ` Edgar Toernig
2005-04-30 23:18 ` Linus Torvalds
2005-05-01 16:46 ` Linus Torvalds
2005-05-01 16:57 ` Randy.Dunlap
2005-05-01 17:23 ` Edgar Toernig
2005-04-30 5:43 ` Junio C Hamano
2005-04-30 10:53 ` Edgar Toernig
2005-04-30 11:13 ` David Woodhouse
2005-04-30 12:08 ` Kay Sievers
2005-04-30 12:13 ` David Woodhouse
2005-04-30 12:49 ` Edgar Toernig
2005-04-30 12:59 ` David Woodhouse
2005-04-30 13:22 ` Edgar Toernig
2005-05-02 22:10 ` Krzysztof Halasa
2005-05-02 22:26 ` H. Peter Anvin
2005-05-02 23:30 ` Krzysztof Halasa
2005-05-02 23:32 ` H. Peter Anvin
2005-05-03 0:30 ` Krzysztof Halasa
2005-05-03 0:38 ` H. Peter Anvin
2005-04-30 23:14 ` H. Peter Anvin
2005-04-30 4:50 ` Edgar Toernig
-- strict thread matches above, loose matches on Subject: below --
2005-04-30 5:28 Luck, Tony
2005-04-30 23:14 ` H. Peter Anvin
2005-04-29 23:14 tony.luck
2005-04-29 23:35 ` H. Peter Anvin
2005-04-30 0:21 ` tony.luck
2005-04-30 3:23 ` Edgar Toernig
2005-04-30 3:47 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1114848175.24014.35.camel@localhost.localdomain \
--to=dwmw2@infradead$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=rra@stanford$(echo .)edu \
--cc=torvalds@osdl$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox