Guardian Programmer's Guide

Table Of Contents
Managing Time
Guardian Programmer’s Guide 421922-014
18 - 6
Time and Date Manipulation
Time and Date Manipulation
This subsection describes how to use the system procedures that obtain or manipulate
Julian timestamps (64 bits) or 48-bit timestamps. These operations include:
Obtaining timestamps
Computing a time interval
Converting between timestamps and a Gregorian representation of the date and
the time of day
Working With 64-Bit Julian Timestamps
You should use a Julian timestamp whenever you need to measure a time interval or
apply a timestamp to an event.
When you measure a time interval, you need to be sure that no clock adjustments are
made during the interval. The Julian timestamp is not affected by daylight saving time.
When applying a timestamp to an event (such as updating a record), you need a
common basis for all such timestamps. Again you should use the GMT Julian
timestamp not only to avoid confusion during daylight saving transition but also to
provide a standard that can be used in different time zones. The following tasks
involve Julian timestamps:
Obtain a Julian timestamp from your local node or from a remote node in the
network (JULIANTIMESTAMP procedure).
Time an interval using Julian timestamps (JULIANTIMESTAMP procedure).
Convert a Julian timestamp into a Gregorian date and time of day
(INTERPRETTIMESTAMP procedure).
Convert a Gregorian date and time of day into a Julian timestamp
(COMPUTETIMESTAMP procedure).
Convert Julian timestamps between local time and GMT (CONVERTTIMESTAMP
procedure).
Convert a period of time specified in microseconds into a number of hours,
minutes, seconds, milliseconds, and microseconds (INTERPRETINTERVAL
procedure).
The following paragraphs describe how to perform these tasks.
Obtaining a Julian Timestamp: Local Node
To obtain a Julian timestamp, you call the JULIANTIMESTAMP procedure. This
procedure can return GMT for the current time, GMT at the last system cold load, GMT