For example, I am in the EST/EDT zone, which changes to daylight time (EDT)
on the second Sunday in March (M3.2.0), and back to standard time (EST)
the first Sunday in November (M11.1.0). Eastern time is 5 hours behind
GMT, so EST5, while EDT is only 4 hours behind, so EDT4. (The routines
default to changing at 2AM, so my setting keeps that default.)
putenv("TZ=EST5EDT4,M3.2.0,M11.1.0");
/* Print local time, showing time zone in use */
time_t t=time(NULL);
if(t != (time_t)-1) {
/* Include time zone in printout (if have) */
char buf[40];
const char *fmt="%a %b %e %H:%M:%S %Z %Y";
struct tm *tm_p;
tm_p = localtime(&t);
strftime(buf, sizeof(buf), fmt, tm_p);
puts(buf);
}
Sample output:
Tue Jun 3 14:12:07 EDT 2008
I am not familiar with your zone, but it would be something like
"TZ=CET-2CEST-1,M3.5.0/01:00:00,M10.5.0/01:00:00" if the CEST article on
Wikipedia had the right information (changing at 1AM the last Sunday
of March and the last Sunday of October, normally 2 hours ahead of GMT).
Craig
-----Original Message-----
From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org] On Behalf Of Heiko
Sent: Tuesday, June 03, 2008 4:31 AM
To: newlib@sources.redhat.com
Subject: Format of "__tzinfo_type tzinfo"
Hello,
I´ll use the time-functions from newlib.
Can somebody explain me the meaning of the elements from "__tzinfo_type
tzinfo" (\libc\time\gettzinfo.c)?
typedef struct __tzrule_struct
{
char ch;
int m;
int n;
int d;
int s;
time_t change;
long offset; /* Match type of _timezone. */
} __tzrule_type;
typedef struct __tzinfo_struct
{
int __tznorth;
int __tzyear;
__tzrule_type __tzrule[2];
} __tzinfo_type;
I need it for conversion from UTZ to CET/CEST.
Thanks and wbr
Heiko