Timestamps are used in most computer systems to define the
date and or time associated with an event or transaction.
There are several standards for defining date and time but
they are not consistently followed so every computer platform,
operating system, and language has different formats and
methods for processing date and time information.
Perhaps the closest thing to a consistent standard is the
8601 standard for external date amd time which simply says
the sequence should be 4 digit year, month, day, hour, minute,
and second so the timestamps can be compared and sorted
easily. The year, month, and day typically refer to the
Gregorian Calender which is the most widely used and is
the defacto standard. To simplify date calculations and
time interval measurement, timestamps are often stored as a
single numeric number with 0 representing some
zone arbitrary starting time called an
epoch. There are many different date and time
epochs in use today including:
For 32 bit computer systems that count seconds from the
epoch January 1, 1970 such as some Unix and Linux systems, the
counter will overflow in the year 2038 potentially causing
another Y2K type event unless these systems are converted to
use 64 bit counters or the epoch is moved forward to delay the
inevitable. For those interested in a standard
Time for planet earth, there is
(also called UTC or UT1). For geologists there is
geological time starting about 5 billion years ago.
Then for those interested in a truly
universal time scale, consider joining
SETI (one of the
worlds largest distributed processing grid projects to detect
extra terrestrials intelligence) and get ready to redefine
"Universal Time" when we discover a plant that has its own
universal time starting perhaps 10 billion years ago.
Calling earth time as "Universal" is like declaring the earth
as the center of the universe.
Moving from the galactic scale down to the sub second
scale, timestamps are also often used to to uniquely identify
events within a computer system. And as the speed of
computer chips continue to increase with cycle times exceeding
GHZ, there is a need for more precise timestamps measuring
microseconds and nanoseconds. The
z390 version of the IBM
mainframe compatible TIME macro has added a new time NS which
returns a 64 bit value representing the nanoseconds since the
J2SE Java runtime startup. This function uses
System.nanotime() class method which in turn for Windows
host operating systems uses the
QueryPerformanceCounter functions for measuring short
intervals. A similar approach has been used recently to
add a Micro Focus Mainframe Express COBOL callable routine
named GETTIME that returns the current date and time in
microseconds using the Windows January 1, 1601 epoch and the
GetSystemTimeAsFileTime. This COBOL function
is available from Micro Focus for customer use. There
are similar functions in C, Java, SQL, XML and other languages
but they are all different enough that a change in platform,
operating system, or language vendor will probably require
conversion. Have you noticed that almost every computer
installation has its own set of callable date and time
routines that have evolved for the years and are ofter written
Mainframe Assembler Timestamp Support
z/OS and z390 Mainframe
Assembler languages support the
TIME macro to retrieve date and time in verious formats.
z390 has added the following extensions to its TIME macro:
1. TIME TS,ADDR=timestamp returns 29 character EBCDIC timestamp in
the following format:
YYYY-MM-DD HH:MM:SS.NNNNNNNNN WHERE
NNNNNNNNN is in nanoseconds. This is the same
JDBC SQL timestamp.
2. TIME NS returns nanosecond counter for use in interval
measurements in 64 bit GPR 0.
3. CLOCK=JAVA returns time since J2SE epoch Jan. 1, 1970 versus
default IBM epoch Jan. 1, 1900. (Note Windows system
uses epoch Jan 1, 1601 and Linux system uses the same epoch as
J2SE Jan. 1, 1970.)
The COBOL standards support obtaining date and time in
numerous formats using intrinsic functions and ACCEPT options.
For comprehensive lists see:
Unfortunately there does not appear to be a
consistent standard COBOL method to obtain time of day in microseconds or
nanoseconds for more precise interval timing. As a
result calls to functions written in C or assembler are often
used to obtain such time formats.
For Micro Focus Mainframe Express COBOL running on
Windows, there is now a subroutine written in COBOL which uses
the WIN32API interface to the Windows time functions to obtain
the time of day in microseconds. This routine is
available to Micro Focus customers.