From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9576 invoked by alias); 22 Sep 2012 08:55:54 -0000 Received: (qmail 9068 invoked by uid 48); 22 Sep 2012 08:54:41 -0000 From: "eugene.kopyshev at gmail dot com" To: glibc-bugs@sources.redhat.com Subject: [Bug libc/14606] New: lost 1h in gmtime, ctime extracted date Date: Sat, 22 Sep 2012 08:55:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: eugene.kopyshev at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2012-09/txt/msg00209.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=14606 Bug #: 14606 Summary: lost 1h in gmtime, ctime extracted date Product: glibc Version: 2.11 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: unassigned@sourceware.org ReportedBy: eugene.kopyshev@gmail.com CC: drepper.fsp@gmail.com Classification: Unclassified Every year, random day in Oct, ctime resolves two different epoch times into the same string date. tz not set, not affected, not makes an influence. For example: 1351385541 2012-10-28 1:52:21 Sun Oct 28 01:52:21 2012 1351389141 2012-10-28 1:52:21 Sun Oct 28 01:52:21 2012 A code to get output as above: #include #include int main() { time_t t; struct tm *tm; t=1351385541; tm=gmtime(&t); printf( "%lu %d-%d-%d %d:%d:%d %s", t, tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, ctime(&t) ); t=1351389141; tm=gmtime(&t); printf( "%lu %d-%d-%d %d:%d:%d %s", t, tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, ctime(&t) ); } -- 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.