Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ utc_gmtzone(3dts) — DCE 3.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

utc_gmtzone(3dts)  —  Subroutines

Name

utc_gmtzone - 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

tzlenLength of buffer tzname. 

utcBinary timestamp.  This parameter is ignored. 

Output

tznameCharacter string long enough to hold the time zone label. 

tdfLong word with differential in seconds east of GMT.  A value of 0 (zero) is always returned. 

isdstInteger with a value of 0 (zero), indicating that daylight saving time is not in effect.  A value of 0 (zero) is always returned. 

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. 

Notes

All of the output parameters are optional.  No value is returned and no error occurs if the tzname pointer is NULL. 

Return Values

0Indicates 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). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026