timezone Subroutine

Attention: Do not use the tzset subroutine, when linking the libc.a and libbsd.a libraries. The tzset subroutine uses the timezone global external variable that conflicts with the timezone subroutine in the libbsd.a library. This name collision can cause unpredictable results.

Purpose

Returns the name of the time zone that is associated with the first parameter.

Library

Berkeley compatibility library (libbsd.a) (for the timezone subroutine only)

Syntax

#include <time.h>
char *timezone(zone, dst)
int zone;
int dst;
#include <time.h>
#include <limits.h>
int zone;
int dst;

Description

The timezone subroutine returns the name of the time zone that is associated with the zone parameter. The zone parameter is measured in minutes westward from Greenwich. If the TZ environment variable is set, the zone parameter is ignored, and the current time zone is calculated from the value of the TZ environment variable. If the value of the dst parameter is 0, the standard name is returned; otherwise the name of daylight saving time is returned. If the TZ environment variable is not set, the internal table is searched for a matching time zone. If the time zone does not appear in the built in table, the difference from GMT is produced.

The timezone subroutine returns a pointer to static data, which will be overwritten by subsequent calls.

Parameters

Item Description
zone Specifies minutes westward from Greenwich.
dst Specifies whether to return standard time or daylight saving time.

Return Values

The timezone subroutine returns a pointer to the czone global variable, which contains the name of the time zone.