public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pitrou at free dot fr" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug libc/13401] New: calling localtime() or mktime() with a time far in the past corrupts cached timezone info Date: Fri, 11 Nov 2011 00:08:00 -0000 [thread overview] Message-ID: <bug-13401-131@http.sourceware.org/bugzilla/> (raw) http://sourceware.org/bugzilla/show_bug.cgi?id=13401 Bug #: 13401 Summary: calling localtime() or mktime() with a time far in the past corrupts cached timezone info Product: glibc Version: 2.12 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: drepper.fsp@gmail.com ReportedBy: pitrou@free.fr Classification: Unclassified See the following snippet: #include <time.h> #include <stdlib.h> int main() { time_t t; struct tm tmp; char str[200]; t = time(NULL); tmp = *gmtime(&t); tmp.tm_gmtoff = 0; tmp.tm_zone = NULL; strftime(str, sizeof(str), "%Z", &tmp); puts(str); t = -2461446500; localtime(&t); t = time(NULL); tmp = *gmtime(&t); tmp.tm_gmtoff = 0; tmp.tm_zone = NULL; strftime(str, sizeof(str), "%Z", &tmp); puts(str); return 0; } Output here is: CET PMT After a bit of digging, it seems the external variable "tzname" gets (wrongly) mutated by the localtime() call. The "%Z" format specifier just reuses that info. This issue got reproduced on several distributions, see http://bugs.python.org/issue13309 -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
next reply other threads:[~2011-11-11 0:08 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-11-11 0:08 pitrou at free dot fr [this message] 2011-11-11 11:36 ` [Bug libc/13401] " rosslagerwall at gmail dot com 2011-11-21 13:11 ` schwab@linux-m68k.org 2011-11-21 15:02 ` pitrou at free dot fr 2014-06-27 11:37 ` fweimer at redhat dot com
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=bug-13401-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.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: linkBe 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 read-only IMAP folder(s) and NNTP newsgroup(s).