Module Interface SysClock

SUMMARY: MODULE | CLASS | TYPE | PROC | VAR | CONST | DETAIL: TYPE | PROC | VAR | CONST

# SysClock

Type Summary
DateTime = RECORD ... END

Procedure Summary
CanGetClock(): BOOLEAN Returns TRUE if a system clock can be read; FALSE otherwise.
CanSetClock(): BOOLEAN Returns TRUE if a system clock can be set; FALSE otherwise.
GetClock(VAR DateTime) If possible, assigns system date and time of day to userData.
GetTimeOfDay(VAR LONGINT, VAR LONGINT): LONGINT PRIVAT.
IsValidDateTime(DateTime): BOOLEAN Returns TRUE if the value of d represents a valid date and time; FALSE otherwise.
MakeLocalTime(VAR DateTime) Fill in the daylight savings mode and time zone for calendar date c.
SetClock(DateTime) If possible, sets the system clock to the values of userData.

Constant Summary
active Daylight savings adjustments are being used.
inactive Daylight savings adjustments are not in effect.
localTime Time zone is inactive and time is local.
maxSecondParts Most systems have just millisecond accuracy.
unknown Current daylight savings status is unknown.
unknownZone Time zone is unknown.
zoneMax time zone maximum minutes.
zoneMin Time zone minimum minutes.

Type Detail

### DateTime

    TYPE DateTime = RECORD
                        year: INTEGER;
                        month: SHORTINT;
                        day: SHORTINT;
                        hour: SHORTINT;
                        minute: SHORTINT;
                        second: SHORTINT;
                        summerTimeFlag: SHORTINT;
                        fractions: INTEGER;
                        zone: INTEGER;
                    END

Procedure Detail

### CanGetClock

    PROCEDURE CanGetClock(): BOOLEAN

> Returns TRUE if a system clock can be read; FALSE otherwise.

### CanSetClock

    PROCEDURE CanSetClock(): BOOLEAN

> Returns TRUE if a system clock can be set; FALSE otherwise.

### GetClock

    PROCEDURE GetClock(VAR userData: DateTime)

> If possible, assigns system date and time of day to userData. That is, the local time is returned. Error returns ``1 Jan 1970`'.

### GetTimeOfDay

    PROCEDURE GetTimeOfDay(VAR sec: LONGINT;
                           VAR usec: LONGINT): LONGINT

> PRIVAT. Don't use this. Take Time.GetTime instead. Equivalent to the C function `gettimeofday'. The return value is `0' on success and `-1' on failure; in the latter case `sec' and `usec' are set to zero.

### IsValidDateTime

    PROCEDURE IsValidDateTime(d: DateTime): BOOLEAN

> Returns TRUE if the value of d represents a valid date and time; FALSE otherwise.

### MakeLocalTime

    PROCEDURE MakeLocalTime(VAR c: DateTime)

> Fill in the daylight savings mode and time zone for calendar date c. The fields c.zone and c.summerTimeFlag given in c are ignored, assuming that the rest of the record describes a local time.

> Note 1: On most Unix systems the time zone information is only available for dates falling within approximately ``1 Jan 1902`' to ``31 Dec 2037`'. Outside this range the field c.zone will be set to the unspecified localTime value, and c.summerTimeFlag will be set to unknown.

> Note 2: The time zone information might not be fully accurate for past (and future) years that apply different DST rules than the current year. Usually the current set of rules is used for all years between 1902 and 2037.

> Note 3: With DST there is one hour in the year that happens twice: the hour after which the clock is turned back for a full hour. It is undefined which time zone will be selected for dates refering to this hour, that is, whether DST or normal time zone will be chosen.

### SetClock

    PROCEDURE SetClock(userData: DateTime)

> If possible, sets the system clock to the values of userData.

Constant Detail

### active

    CONST active

> Daylight savings adjustments are being used.

### inactive

    CONST inactive

> Daylight savings adjustments are not in effect.

### localTime

    CONST localTime

> Time zone is inactive and time is local.

### maxSecondParts

    CONST maxSecondParts

> Most systems have just millisecond accuracy.

### unknown

    CONST unknown

> Current daylight savings status is unknown.

### unknownZone

    CONST unknownZone

> Time zone is unknown.

### zoneMax

    CONST zoneMax

> time zone maximum minutes.

### zoneMin

    CONST zoneMin

> Time zone minimum minutes.