[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Glibc 2.2.5 mktime() - differences between distributions



It seems that Red Hat's latest glibc has introduced a strict
interpretation of the  ISO C mktime() definition, such that dates before
1970 are now considered to be out of range.  This has caused breakage of
any application that relies on the old behaviour, such as PostgreSQL.

It is also the case that neither Debian's nor Suse's glibc show this
change; nor is it mentioned in their changelogs..

Do you know why this change has occurred only in Red Hat's version?  Are
the distributions' version numbers out of sync?

A small program for testing is attached.  On Debian's latest libc6 it
reports a timestamp of -31712400, but on latest Red Hat it apparently
reports -1.

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "And Jesus answering said unto them, They that are
      whole need not a physician; but they that are sick. I
      come not to call the righteous, but sinners to
      repentance."                     Luke 5:31,32
#include <stdio.h>
#include <time.h>

int main(int argc, char *argv[])
{
    int failout;
    
    struct tm fails;

    fails.tm_sec = 0;
    fails.tm_min = 0;
    fails.tm_hour = 0;
    fails.tm_hour = 0;
    fails.tm_isdst = -1;

    fails.tm_year = 68;
    fails.tm_mon = 11;
    fails.tm_mday = 30;

    failout = mktime(&fails);
    printf("The system thinks 11/30/1969 is a timestamp of %d \n", failout);
    
    return 0;
}

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: