[Top] [Prev] [Next] [Bottom]


[Contents] [Index]

daytime - time conversions

include "daytime.m";
daytime:= load Daytime Daytime->PATH;

Tm: adt
{
  sec:     int;
  min:     int;
  hour:    int;
  mday:    int;
  mon:     int;
  year:    int;
  wday:    int;
  yday:    int;
  zone:    string;
  tzoff:   int;
};
text:     fn(tm: ref Tm)    : string;
filet:    fn(now, file: int): string;
gmt:      fn(tim: int)      : ref Tm;
local:    fn(tim: int)      : ref Tm;
now:      fn()              : int;
time:     fn()              : string;
tm2epoch: fn(tm: ref Tm)    : int;

Description

These routines perform time conversions relative to the epoch 00:00:00 GMT, Jan. 1, 1970.

text

text: fn(tm: ref Tm): string;
The text function converts a Tm adt referenced by tm from local or GMT time to a string in the format:

Tue Aug 16 17:03:52 CDT 1977

filet

filet: fn(now, file: int): string;
The filet function converts the file time file from seconds since the epoch to local time as a string in the format: Aug 16 17:03 if the file is less than 6 months old or Aug 16 1977 if the file is older than 6 months.

gmt

gmt: fn(tim: int): ref Tm;
The gmt function converts seconds since the epoch contained in tim to a Tm adt in Greenwich Mean Time (GMT).

local

local: fn(tim: int): ref Tm;
The local function converts seconds since the epoch contained in tim to a Tm adt in local time.

now

now: fn(): int;
## returns seconds since epoch; 0 if error.
The now function returns the time in seconds since the epoch. This functions works by reading file /dev/time to get the time in microseconds since the epoch.

time

time: fn(): string;
The time function returns the local time as a string in the format:

Tue Aug 16 17:03:52 CDT 1977

tm2epoch

tm2epoch: fn(tm: ref Tm): int;
## returns seconds since epoch.
The tm2epoch function converts a Tm adt referenced by tm from local time to seconds since the epoch.

Caveat

The sign bit of a Limbo integer holding a time will turn approximately 68 years from the epoch.

'GMT' is used rather than 'UTC' as in other operating systems. There is no serious treatment of leap seconds; instead the epoch is implicitly shifted. Existing practice also dictate the following conventions:
year=96 means 1996
mday=1 means first day of the month
wday=0 means Sunday
mon=0 means January



[Top] [Prev] [Next] [Bottom]

infernosupport@lucent.com
Copyright © 1997, Lucent Technologies, Inc.. All rights reserved.