NetBSD-Users archive

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

question about strptime on NetBSD 6 stable




Hi, 

It seems like strptime is ignoring %z on NetBSD 6 stable? Or maybe i'm doing it 
wrong.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int
main (int argc, char **argv)
{
        struct tm etm;
        memset (&etm,0,sizeof(struct tm));
        strptime("Mon, 6 Feb 2012 00:35:49 +0100","%a, %d %b %Y %H:%M:%S 
%z",&etm);
        time_t m;
        m=mktime(&etm);
        printf("%i\n",m);
}


# gcc -o testc testc.c
# ./testc
1328517349
# date
Tue Feb 19 17:26:02 PST 2013

this returns, 1328517349 but I think this is only correct for Feb 6, 2012 
00:35:49 in my timezone (pacific)



Here's the results of the same code on a "different" BSD system.. ie not NetBSD.


# gcc -o testc testc.c
# ./testc
1328484949
# date
Tue Feb 19 17:27:50 PST 2013

I believe the 1328484949 is correct, which is 02/05/2012 3:35 pm pacific time.

Any suggestions/pointers appreciated..

Thank you,


-- 
Waitman Gobble
San Jose California USA


Home | Main Index | Thread Index | Old Index