[BACK]Return to tzset.3 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / time

File: [cvs.NetBSD.org] / src / lib / libc / time / tzset.3 (download)

Revision 1.25, Fri Dec 17 01:29:45 2010 UTC (13 years, 4 months ago) by wiz
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-mips64-premerge-20101231, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver
Branch point for: yamt-pagecache, tls-maxphys
Changes since 1.24: +2 -2 lines

Use more markup.

.\"	$NetBSD: tzset.3,v 1.25 2010/12/17 01:29:45 wiz Exp $
.Dd April 1, 2001
.Dt TZSET 3
.Os
.Sh NAME
.Nm tzset
.Nd initialize time conversion information
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In time.h
.Ft void
.Fn tzset "void"
.Sh DESCRIPTION
The
.Fn tzset
function uses the value of the environment variable
.Ev TZ
to set time conversion information used by
.Xr localtime 3 .
If
.Ev TZ
does not appear in the environment,
the best available approximation to local wall clock time, as
specified by the
.Xr tzfile 5
format file
.Pa /etc/localtime
is used by
.Xr localtime 3 .
If
.Ev TZ
appears in the environment but its value is a null string,
Coordinated Universal Time (UTC) is used (without leap second
correction).
If
.Ev TZ
appears in the environment and its value is not a null string:
.Bl -dash
.It
if the value begins with a colon, it is used as a pathname of a file
from which to read the time conversion information;
.It
if the value does not begin with a colon, it is first used as the
pathname of a file from which to read the time conversion information,
and, if that file cannot be read, is used directly as a specification
of the time conversion information.
.El
.Pp
When
.Ev TZ
is used as a pathname, if it begins with a slash, it is used as an
absolute pathname; otherwise, it is used as a pathname relative to
.Pa /usr/share/zoneinfo .
The file must be in the format specified in
.Xr tzfile 5 .
.Pp
When
.Ev TZ
is used directly as a specification of the time conversion information,
it must have the following syntax (spaces inserted for clarity):
.Sm off
.Bd -literal -offset indent
.Cm std Cm offset Oo
.Cm dst Oo
.Cm offset Oc Oo
.No , Cm rule Oc Oc
.Ed
.Sm on
.Pp
where:
.Bl -tag -width "std and dst" -compact
.It Cm std No and Cm dst
Three or more bytes that are the designation for the standard
.Cm ( std )
or summer
.Cm ( dst )
time zone.
Only
.Cm std
is required; if
.Cm dst
is missing, then summer time does not apply in this locale.
Upper- and lowercase letters are explicitly allowed.
Any characters except a leading colon (:), digits, comma (,), minus (-),
plus (+), and ASCII NUL are allowed.
.It Cm offset
Indicates the value one must add to the local time to arrive at
Coordinated Universal Time.
The
.Cm offset
has the form:
.Sm off
.Bd -literal -offset indent
.Cm hh Oo
.Cm :mm Oo
.Cm :ss Oc Oc
.Ed
.Sm on
.Pp
The minutes
.Cm ( mm )
and seconds
.Cm ( ss )
are optional.
The hour
.Cm ( hh )
is required and may be a single digit.
The
.Cm offset
following
.Cm std
is required.
If no
.Cm offset
follows
.Cm dst ,
summer time is assumed to be one hour ahead of standard time.
One or more digits may be used; the value is always interpreted as a
decimal number.
The hour must be between zero and 24, and the minutes (and
seconds) \(em if present \(em between zero and 59.
If preceded by a
.Dq -
the time zone shall be east of the Prime Meridian; otherwise it shall be
west (which may be indicated by an optional preceding
.Dq + ) .
.It Cm rule
Indicates when to change to and back from summer time.
The
.Cm rule
has the form:
.Sm off
.Bd -literal -offset indent
.Xo
.Cm date No /
.Cm time No ,
.Cm date No /
.Cm time
.Xc
.Ed
.Sm on
.Pp
where the first
.Cm date
describes when the change from standard to summer time occurs and the
second
.Cm date
describes when the change back happens.
Each
.Cm time
field describes when, in current local time, the change to the other
time is made.
The format of
.Fa date
is one of the following:
.Bl -tag -width "The Julian day" -compact
.It Cm J Ns Ar n
The Julian day
.Ar n
(1 \*[Le]
.Ar n
\*[Le] 365).
Leap days are not counted; that is, in all years \(em including leap
years \(em February 28 is day 59 and March 1 is day 60.
It is impossible to explicitly refer to the occasional February 29.
.It Ar n
The zero-based Julian day (0\ \*[Le]
.Ar n
\*[Le]\ 365).
Leap days are counted, and it is possible to refer to
February 29.
.Sm off
.It Cm M Ns Ar m No . Ar n No . Ar d
.Sm on
The
.Ar d Ns 'th
day
(0 \*[Le]
.Ar d
\*[Le]\ 6) of week
.Ar n
of month
.Ar m
of the year
(1 \*[Le]
.Ar n
\*[Le]\ 5, 1 \*[Le]
.Ar m
\*[Le]\ 12, where week 5 means
.Dq the\ last Ar d No day\ in\ month Ar m
which may occur in either the fourth or the fifth week).
Week 1 is the first week in which the
.Ar d Ns 'th
day occurs.
Day zero is Sunday.
.El
The
.Cm time
has the same format as
.Cm offset
except that no leading sign
.Dq -
or
.Dq +
is allowed.
The default, if
.Cm time
is not given, is
.Cm 02:00:00 .
.El
If no
.Cm rule
is present in
.Ev TZ ,
the rules specified by the
.Xr tzfile 5
format file
.Pa posixrules
in
.Pa /usr/share/zoneinfo
are used, with the standard and summer time offsets from UTC replaced
by those specified by the
.Cm offset
values in
.Ev TZ .
.Pp
For compatibility with System V Release 3.1, a semicolon (;) may be
used to separate the
.Cm rule
from the rest of the specification.
.Pp
If the
.Ev TZ
environment variable does not specify a
.Xr tzfile 5
format file and cannot be interpreted as a direct specification, UTC
is used.
.Sh FILES
.Bl -tag -width /usr/share/zoneinfo/posixrules -compact
.It Pa /etc/localtime
local time zone file
.It Pa /usr/share/zoneinfo
time zone information directory
.It Pa /usr/share/zoneinfo/posixrules
used with POSIX-style TZ's
.It Pa /usr/share/zoneinfo/GMT
for UTC leap seconds
.El
.Pp
If
.Pa /usr/share/zoneinfo/GMT
is absent, UTC leap seconds are loaded from
.Pa /usr/share/zoneinfo/posixrules .
.Sh SEE ALSO
.Xr ctime 3 ,
.Xr getenv 3 ,
.Xr strftime 3 ,
.Xr time 3 ,
.Xr tzfile 5
.Sh STANDARDS
The
.Fn tzset
function conforms to
.St -p1003.1-88 .
.\" @(#)newtzset.3	8.2
.\" This file is in the public domain, so clarified as of
.\" 2009-05-17 by Arthur David Olson.