|
utc_gmtzone(3dts)
Gets the time zone label for GMT
Synopsis
#include <dce/utc.h> int utc_gmtzone( char *tzname, size_t tzlen,
long *tdf, int *isdst, utc_t *utc);
Parameters
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 of GMT. A value of 0 (zero) is always returned.
isdst Integer with a value of 0 (zero), indicating that daylight saving time is not in effect. A value of 0 (zero) is always returned.
Notes All output parameters are optional. No value is returned and no error occurs if the tzname pointer is NULL.
Description The utc_gmtzone( ) routine gets the time zone label and zero offset from GMT. Outputs are always tdf=0 and tzname=GMT. This
routine exists for symmetry with the utc_anyzone( ) and the utc_localzone( ) routines. Use NULL if you want this routine to use the current time for this parameter.
Return Values ~0 Indicates that the routine executed successfully (always returned).
Examples 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 */ (int *)0, /* Out: TDF of local time */ &now); /* In: Current timestamp (ignore)
*/ /* 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 */
/* (ignore) */ /* 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");
Related Information Functions:
utc_anyzone(3dts)
utc_gmtime(3dts)
utc_localzone(3dts)
|