public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "quae at daurnimator dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/17189] New: Incorrect result for %s in strftime Date: Mon, 21 Jul 2014 16:10:00 -0000 [thread overview] Message-ID: <bug-17189-131@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=17189 Bug ID: 17189 Summary: Incorrect result for %s in strftime Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: quae at daurnimator dot com CC: drepper.fsp at gmail dot com The %s specifier in strftime doesn't respect timezones. Example: #include <time.h> #include <stdio.h> int main() { time_t t = 1234567890; struct tm *tmp = gmtime(&t); char output[200]; strftime(output, 200, "%s", tmp); printf("%s\n",output); return 0; } Run with a non UTC timezone. e.g. TZ=GMT+9 Output will be 1234600290 instead of expected 1234567890 Location in glibc: http://fossies.org/dox/glibc-2.19/strftime__l_8c_source.html#l01133 This bug also exists in BSD's libc: https://svnweb.freebsd.org/base/release/10.0.0/lib/libc/stdtime/strftime.c?view=markup#l312 It does not occur in musl: http://git.musl-libc.org/cgit/musl/tree/src/time/strftime.c?id=ac0acd569e01735fc6052d43fdf57f3a07c93f3d#n127 -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2014-07-21 16:10 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-07-21 16:10 quae at daurnimator dot com [this message] 2014-08-18 19:24 ` [Bug libc/17189] " quae at daurnimator dot com 2015-01-03 1:39 ` emaste at freebsd dot org 2015-08-27 22:23 ` [Bug time/17189] " jsm28 at gcc dot gnu.org
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-17189-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /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).