File Archive

 
Output of file : SETTZ.C contained in archive : NAVYTIME.ZIP

/* settz -- set time zone information from environment (Turbo C) */
/* copyright 1987 Michael M Rubenstein */

/* Examines the environment variable TZ and sets timezone and daylight */
/* accordingly. TZ should consist of 0 or more letters, an integer , 0 or */
/* more letters. The initial letters are ignored. The integer (which may */
/* be negative) gives the number of hours behind GMT. If any letters */
/* follow the integer, daylight is set to 1. */

/* For EST/DST, the environment variable TZ should be EST5DST. For EST */
/* only, the variable should be EST5. At present the letters are ignored */
/* except for setting daylight. */

#include
#include
#include
#include

void settz(void)
{
char *tz;

if ((tz = getenv("TZ")) == NULL)
return;
while (isalpha(*tz))
++tz;

timezone = (long) atoi(tz) * 3600l;
while (*tz != '\0' && !isalpha(*tz))
++tz;
daylight = (*tz != '\0');
}