VMS Help
DECdts, utc_gmtzone
*Conan The Librarian
|
Gets the time zone label for GMT.
Format
#include <utc.h>
int utc_gmtzone(*tzname, tzlen, *tdf, *isdst, *utc)
char *tzname;
size_t tzlen;
long *tdf;
int *isdst;
const utc_t *utc;
Input
tzlen
Length of buffer tzname.
utc
Binary timestamp. This parameter is ignored.
Output
tzname
Character string long enough to hold the time zone label.
tdf
Longword with differential in seconds east or west of GMT. A
value of zero is always returned.
isdst
Integer with a value of zero, indicating that daylight saving
time is not in effect. A value of zero is always returned.
The Greenwich Mean Time Zone routine gets the time zone label
and zero offset from GMT. Outputs are always tdf = 0 and tzname
anyzone) and the Local Zone (utc_localzone) routines.
All of the output parameters are optional. No value is returned
and no error occurs if the tzname pointer is NULL.
0 Indicates that the routine executed successfully (always
returned).
The following example prints out the current time in both local
time and GMT time.
utc_t now;
struct tm tmlocal, tmgmt;
long tzoffset;
int tzdaylight;
char tzlocal[80], tzgmt[80];
/*
* Get the current time once, so both conversions use the same
* time...
*/
utc_gettime(&now);
/*
* Convert to local time, using the process TZ environment
* variable...
*/
utc_localtime(&tmlocal, /* Out: Local time tm structure */
(long *)0, /* Out: Nanosec of time */
(struct tm *)0, /* Out: Inaccuracy tm structure */
(long *)0, /* Out: Nanosec of inaccuracy */
&now); /* In: Current binary timestamp */
/*
* Get the local time zone name, offset from GMT, and current
* daylight savings flag...
*/
utc_localzone(tzlocal, /* Out: Local time zone name */
80, /* In: Length of loc time zone name */
&tzoffset, /* Out: Loc time zone offset in secs */
&tzdaylight, /* Out: Local time zone daylight flag */
&now); /* In: Current binary timestamp */
/*
* Convert to GMT...
*/
utc_gmtime(&tmgmt, /* Out: GMT tm structure */
(long *)0, /* Out: Nanoseconds of time */
(struct tm *)0, /* Out: Inaccuracy tm structure */
(long *)0, /* Out: Nanoseconds of inaccuracy */
&now); /* In: Current binary timestamp */
/*
* Get the GMT time zone name...
*/
utc_gmtzone(tzgmt, /* Out: GMT time zone name */
80, /* In: Size of GMT time zone name */
(long *)0, /* Out: GMT time zone offset in secs */
(int *)0, /* Out: GMT time zone daylight flag */
&now); /* In: Current binary timestamp */
/*
* Print out times and time zone information in the following
* format:
*
* 12:00:37 (EDT) = 16:00:37 (GMT)
* EDT is -240 minutes ahead of Greenwich Mean Time.
* Daylight savings time is in effect.
*/
printf("%d:%02d:%02d (%s) = %d:%02d:%02d (%s)\n",
tmlocal.tm_hour, tmlocal.tm_min, tmlocal.tm_sec, tzlocal,
tmgmt.tm_hour, tmgmt.tm_min, tmgmt.tm_sec, tzgmt);
printf("%s is %d minutes ahead of Greenwich Mean Time\n",
tzlocal, tzoffset/60);
if (tzdaylight != 0)
printf("Daylight savings time is in effect\n");
utc_anyzone, utc_gmtime, utc_localzone