Guardian Programmer's Guide

Table Of Contents
Managing Time
Guardian Programmer’s Guide 421922-014
18 - 14
Working With 48-Bit Timestamps
network node in another time zone. Such a timestamp could be used for displaying the
local time.
When working with 48-bit timestamps, you can perform the following operations:
Obtain a 48-bit timestamp (TIMESTAMP procedure)
Convert a 48-bit timestamp into a Gregorian date and time (CONTIME procedure)
The following paragraphs describe how to perform these operations.
Obtaining a 48-Bit Timestamp
You obtain a 48-bit timestamp using the TIMESTAMP procedure. This procedure
returns the time in 0.01-second units since 00:00 on December 31, 1974, in a three-
word array in the interval-clock parameter:
INT INTERVAL^CLOCK[0:2];
.
.
CALL TIMESTAMP(INTERVAL^CLOCK);
Converting a 48-Bit Timestamp Into a Gregorian Date and
the Time of Day
You can convert a 48-bit timestamp into a 7-word Gregorian date and the time of day
using the CONTIME procedure. The 7-word array that contains the date and time has
the following format:
DATE^AND^TIME[0] Gregorian year (for example, 1990)
DATE^AND^TIME[1] Month of the year (1 to 12)
DATE^AND^TIME[2] Day of the month (1 to 31)
DATE^AND^TIME[3] Hour of the day (0 to 23)
DATE^AND^TIME[4] Minute of the hour (0 to 59)
DATE^AND^TIME[5] Second of the minute (0 to 59)
DATE^AND^TIME[6] Hundredth of the second (0 to 99)
The following example converts a 48-bit timestamp generated by the TIMESTAMP
pr
ocedure into the integer form of the Gregorian date and time of day:
INT INTERVAL^CLOCK[0:2],
DATE^AND^TIME[0:6];
.
.
CALL TIMESTAMP(INTERVAL^CLOCK);
CALL CONTIME(DATE^AND^TIME,
INTERVAL^CLOCK[0],
INTERVAL^CLOCK[1],
INTERVAL^CLOCK[2]);