From: Jason at zx2c4.com (Jason A. Donenfeld)
Subject: [PATCH 2/2 v2] compat/timegm: new compat function for systems lacking timegm()
Date: Thu, 4 Apr 2013 16:59:50 +0200 [thread overview]
Message-ID: <CAHmME9rZ3qm6PHJt_BUEAcEqTw0mOJ7k_HvBOr0w8BKLcm4oZw@mail.gmail.com> (raw)
In-Reply-To: <20130404144632.GL2222@serenity.lan>
On Thu, Apr 4, 2013 at 4:46 PM, John Keeping <john at keeping.me.uk> wrote:
>
> I decided not to do that based on this message:
>
>
> http://lists.samba.org/archive/samba-technical/2002-November/025578.html
>
> but of course it doesn't provide any actual reason for why that version
> doesn't work.
>
Aye yie yie. Time handling functions are a mess. I just went looking at how
glibc [1] and uclibc [2] actually go about doing things, and it's a real
mess in there. Looks like the replacement function in the patch might not
be completely correct.
[1] http://git.uclibc.org/uClibc/tree/libc/misc/time/time.c#n2330
[2]
http://sourceware.org/git/?p=glibc.git;a=blob;f=time/mktime.c;h=e75132c2e457af4b5629eef302c0d6dac15fef5c;hb=HEAD#l348
(uclibc gets bonus points for using cgit)
>
> We only use timegm in week calculations, where we do:
>
> time_t t = timegm(tm);
> t = <new value>;
> gmtime_r(&t, tm);
>
> so I wonder whether it would be equivalent to use mktime/localtime_r
> instead of timegm/gmtime_r.
>
gmtime(timegm(tm)) == tm
and
localtime(mktime(tm)) == tm
So I can't imagine there'd be a problem with just replacing those functions.
next prev parent reply other threads:[~2013-04-04 14:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-01 13:14 [PATCH 1/2] Makefile: re-include cgit.conf in cgit.mk john
2013-04-01 13:14 ` [PATCH 2/2] compat/timegm: new compat function for systems lacking timegm() john
2013-04-01 17:47 ` [PATCH 2/2 v2] " john
2013-04-04 14:13 ` Jason
2013-04-04 14:46 ` john
2013-04-04 14:59 ` Jason [this message]
2013-04-04 17:28 ` john
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=CAHmME9rZ3qm6PHJt_BUEAcEqTw0mOJ7k_HvBOr0w8BKLcm4oZw@mail.gmail.com \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).