Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ctime(3)

difftime(3)

getenv(3)

strftime(3)

time(3)

timezone(3)  —  Subroutines

NAME

daylight, timezone, tzname, tzset - Sets and accesses timezone conversion information

LIBRARY

Standard C Library: (libc.a)

SYNOPSIS

#include <time.h>

void tzset(void):

extern int daylight;
extern long timezone;
extern char ∗tzname[];

DESCRIPTION

The tzset() function uses the /etc/zoneinfo/localtime file to set the time conversion information used by the localtime(), localtime_r(), ctime(), ctime_r(), strftime(), and mktime() functions.  If the TZ variable is set, tzset uses the value of TZ to override the /etc/zoneinfo/localtime file. 

DEC OSF/1 uses a public-domain timezone-handling package that puts timezone conversion rules in easily accessible and modifiable files.  These files are in the directory /etc/zoneinfo/sources.  The timezone compiler zic(8) converts these files to a special format described in tzfile(4) and places them in the /etc/zoneinfo directory.  This format is readable by the C library functions that handle timezone information. 

The tzset() function uses the tzfile-formatted file linked by /etc/zoneinfo/localtime to set the timezone conversion information.  The /etc/zoneinfo/localtime link is set during installation to a file in the /etc/zoneinfo directory.  For example, in the eastern United Stated, /etc/zoneinfo/localtime is linked to /etc/zoneinfo/US/Eastern. 

If the TZ environment variable is defined, the defined value overrides the timezone information in /etc/zoneinfo/localtime.  TZ can be set by a user as a regular environment variable for converting to alternate time zones. 

When TZ appears in the environment and its value is not a null string, the value has one of three formats:

:
:pathname
stdoffset[dst[offset] [,start[/time],end[/time]]]

If TZ has the single colon format (:), GMT is used. 

If TZ has the colon-pathname format (:pathname), the characters following the colon specify the pathname of a tzfile(4) format file from which to read the time conversion information.  A pathname beginning with a slash (/) represents an absolute pathname; otherwise, the pathname is relative to the system time conversion information directory /etc/zoneinfo. 

If TZ does not begin with a colon (:), the components of the string are as follows:

std and dst
Three or more characters that are the designation for the standard (std) or summer (dst) time zone.  Only std is required.  If dst is not supplied, summer time does not apply to the locale.  Upper- and lower-case letters are explicitly allowed.  Any characters, except digits, a leading colon (:), comma (,), minus (-), plus (+), and ASCII NUL, are allowed. 

offsetIndicates the value to be added to the local time to arrive at GMT.  The offset has the form:

     hh[:mm[:ss]]

The minutes (mm) and seconds (ss) are optional.  The hour (hh) is required and can be either one or two digits.  The offset following std is required.  Of no offset follows dst, summer time is assumed to be one hour ahead of standard time.  One or more digits can be used; the value is always interpreted as a decimal number.  The hour value must be between zero and 24.  The value for the minutes and seconds, if present, must be between zero and 59.  If preceded by a minus sign (-), the time zone is east of Greenwich; otherwise it is west, which can be indicated by a preceding plus sign (+). 

start and end
Indicates when to change to and return from summer time.  The start argument is the date when the change from standard to summer time occurs; end is the date for returning from summer time to standard time.  If start and end are not specified, the default is the US Daylight Saving Time start and end dates.  The format for start and end must be one of the following:

JnThe Julian day n (1 ≤ n ≤ 365).  Leap days are not counted.  That is, in all years, including leap years, February 28 is day 59 and March 1 is day 60.  It is impossible to explicitly refer to February 29. 

nThe zero-based Julian day  (0 ≤ n ≤ 365).  Leap days are counted making it possible to refer to February 29. 

Mm.n.dThe nth d day of month m where 0 ≤ n ≤ 5, 0 ≤ d ≤ 6, 1 ≤ m ≤ 12.  When n is 5, it refers to the last d day of month m.  Sunday is day 0. 

timeDescribes the time when, in current time, the change to or return from summer time occurs.  The time parameter has the same format as offset, except that there can be no leading minus (-) or plus (+) sign.  If time is not specified, the default is 02:00:00. 

As an example, the TZ variable value EST5EDT4,M4.1.0,M10.5.0 describes the rule defined in 1987 for the Eastern time zone in the US.  EST (Eastern Standard Time) is the designation for standard time, which is 5 hours behind GMT.  EDT (Eastern Daylight Time) is the designation for summer time, which is 4 hours behind GMT.  EDT starts on the first Sunday in April and ends on the last Sunday in October.  In both cases, since time was not specified, the changes occur at the default time, which is 2:00 a.m.  Note that the start and end dates did not need to be specified since they are the defaults. 

System V Compatibility

For users of the SVID2 habitat, TZ is defined by default in the following format:

std offset [dst[offset] ]

For users of the SVID3 habitat, TZ is defined by default in the following format:

:pathname

See the previous portion of the DESCRIPTION section for definitions of the parameters used in these formats. 

NOTES

The mktime() and tzset() functions are supported for multi-threaded applications. 

AES Support Level:
Full use −− tzset()

RELATED INFORMATION

Functions: ctime(3), difftime(3), getenv(3), strftime(3), time(3)

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