public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/14606] New: lost 1h in gmtime, ctime extracted date
@ 2012-09-22  8:55 eugene.kopyshev at gmail dot com
  2012-09-22  9:28 ` [Bug libc/14606] " schwab@linux-m68k.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: eugene.kopyshev at gmail dot com @ 2012-09-22  8:55 UTC (permalink / raw)
  To: glibc-bugs


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<time.h>
#include<stdio.h>

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/14606] lost 1h in gmtime, ctime extracted date
  2012-09-22  8:55 [Bug libc/14606] New: lost 1h in gmtime, ctime extracted date eugene.kopyshev at gmail dot com
@ 2012-09-22  9:28 ` schwab@linux-m68k.org
  2012-09-22 10:09 ` eugene.kopyshev at gmail dot com
  2014-06-17  4:23 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2012-09-22  9:28 UTC (permalink / raw)
  To: glibc-bugs


http://sourceware.org/bugzilla/show_bug.cgi?id=14606

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> 2012-09-22 09:26:58 UTC ---
The dates are in different time zones, crossing a DST changeover.  See
tm_isdst.

-- 
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/14606] lost 1h in gmtime, ctime extracted date
  2012-09-22  8:55 [Bug libc/14606] New: lost 1h in gmtime, ctime extracted date eugene.kopyshev at gmail dot com
  2012-09-22  9:28 ` [Bug libc/14606] " schwab@linux-m68k.org
@ 2012-09-22 10:09 ` eugene.kopyshev at gmail dot com
  2014-06-17  4:23 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: eugene.kopyshev at gmail dot com @ 2012-09-22 10:09 UTC (permalink / raw)
  To: glibc-bugs


http://sourceware.org/bugzilla/show_bug.cgi?id=14606

--- Comment #2 from Eugene Kopyshev <eugene.kopyshev at gmail dot com> 2012-09-22 10:09:10 UTC ---
Hi Andreas,

Right, but with tm.tm_isdst=0 it works for all "modern" dates and fails
somewhen before the 19xx. Changeover did not exist then?

57718800 Sun Oct 31 02:00:00 1971
57722400 Sun Oct 31 02:00:00 1971

With tm_isdst=-1 it does not work for any year. In case with http server
application is makes tricky to cover past dates... ok, nobody needs it,
hopefully.

Thanka s lot!

2012/9/22 schwab@linux-m68k.org <sourceware-bugzilla@sourceware.org>

>
> http://sourceware.org/bugzilla/show_bug.cgi?id=14606
>
> Andreas Schwab <schwab@linux-m68k.org> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>              Status|NEW                         |RESOLVED
>          Resolution|                            |INVALID
>
> --- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> 2012-09-22
> 09:26:58 UTC ---
> The dates are in different time zones, crossing a DST changeover.  See
> tm_isdst.
>
> --
> Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>

-- 
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/14606] lost 1h in gmtime, ctime extracted date
  2012-09-22  8:55 [Bug libc/14606] New: lost 1h in gmtime, ctime extracted date eugene.kopyshev at gmail dot com
  2012-09-22  9:28 ` [Bug libc/14606] " schwab@linux-m68k.org
  2012-09-22 10:09 ` eugene.kopyshev at gmail dot com
@ 2014-06-17  4:23 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2014-06-17  4:23 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=14606

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-17  4:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-22  8:55 [Bug libc/14606] New: lost 1h in gmtime, ctime extracted date eugene.kopyshev at gmail dot com
2012-09-22  9:28 ` [Bug libc/14606] " schwab@linux-m68k.org
2012-09-22 10:09 ` eugene.kopyshev at gmail dot com
2014-06-17  4:23 ` fweimer at redhat dot com

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).