Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ctime.bsd(3) — Domain/IX SR9.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

gettimeofday(2)

time(3C)

CTIME(3)

NAME

ctime, localtime, gmtime, asctime, timezone −  convert date and time to ASCII

USAGE

char *ctime(clock) long *clock;
 
#include <sys/time.h>
 
struct tm *localtime(clock) long *clock;
 
struct tm *gmtime(clock) long *clock;
 
char *asctime(tm) struct tm *tm;
 
char *timezone(zone, dst)

DESCRIPTION

Ctime converts a time denoted by clock, such as the value returned by time(2), into ASCII and returns a pointer to a 26-character string in the following form.  Thu May 29 10:32:03 1986\n\0 All fields have constant width. Localtime and gmtime return pointers to structures containing the individual components of the time.  Localtime corrects for the time zone and daylight savings time (if necessary); gmtime converts directly to GMT, which is the time DOMAIN/IX uses.  Asctime converts a time from the structures to ASCII and returns a pointer to a 26-character string. 

The structure declaration from the include file is: struct tm { inttm_sec; int tm_min;  int tm_hour;  int tm_mday;  int tm_mon;  int tm_year;  int tm_wday;  int tm_yday;  int tm_isdst; }; These quantities give the time on a 24-hour clock, day of month (1-31), month of year (0-11), day of week (Sunday = 0), year minus (-) 1900, day of year (0-365), and a flag that is non-zero if daylight savings time is in effect. 

When local time is necessary, the program consults the system to determine the time zone and whether the U.S.A., Australian, Eastern European, Middle European, or Western European daylight savings time adjustment is appropriate.  The program understands some of the peculiarities in time conversion over the past 10-20 years; if necessary, this understanding can be extended. 

Timezone returns the name of the time zone associated with its first argument, which is measured in minutes westward from Greenwich.  If the second argument is zero, the standard zone name is used; otherwise, the Daylight Savings Zone.  If the required name does not appear in a table built into the routine, the difference from GMT is produced; e.g., in Afghanistan timezone(-(60*4+30), 0) is appropriate because Afghanistan is four and a half hours ahead of GMT.  This call would produce the string GMT+4:30. 

NOTES

The return values point to static data whose content is overwritten by each call. 

RELATED INFORMATION

gettimeofday(2), time(3C)

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