Project

General

Profile

Bug #2396 ยป tz.c

nobu (Nobuyoshi Nakada), 11/28/2009 10:27 PM

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

int
main(void)
{
time_t now = time(0);
char buf[1024];
struct tm *t = localtime(&now);
int gmtoff = t->tm_gmtoff / 60;
printf("tm_gmtoff = %+03d%02d, tm_zone = %s\n", gmtoff / 60, gmtoff % 60, t->tm_zone);
strftime(buf, sizeof(buf), "tm_gmtoff = %z, tm_zone = %Z\n", t);
fputs(buf, stdout);
return 0;
}
    (1-1/1)