Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Gareth Owen <geo@spclmway.demon.co.uk>
Subject: [Q] - BUG in strptime() DEC UNIX
Date: 1996/03/18	[thread overview]
Message-ID: <827141482snz@spclmway.demon.co.uk> (raw)

The strftime() function in DEC UNIX 3.0 (347) appears to behave strangely
when confronted by the 29th february.

When i try and convert the 29th feb (with or without a leap year as the 
date) the function returns NULL (indicating error) but still correctly
fills the struct tm.  If I pass in a date like 35th feb it correctly returns
NULL and doesn't fill the struct tm.

Is this a bug and is there a fix?

cheers

Gareth Owen

=============

code example:

{
        char *conversion_end;
        struct tm leap_time;
        char time_string[BUFSIZ];

        memset (&leap_time, 0, sizeof(leap_time));

        conversion_end = strftime("29/02/96", "%d/%m/%y", &leap_time);

        if (conversion_end == (char *)NULL)
        {
                printf("conversion failed\n");
        }
        else
        {
                printf("conversion succeeded\n");
        }

        strftime(time_string, BUFSIZ, "%d/%m/%y", &leap_time);

        printf("%s\n", time_string);
}



             reply	other threads:[~1996-03-18  5:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-18  5:00 Gareth Owen [this message]
1996-03-19  5:00 ` [Q] - BUG in strptime() DEC UNIX Stephen Carrier
1996-03-19  5:00   ` Jeff Finkelstein
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox