CEEGMT: get current Greenwich Mean Time

CEEGMT returns the current Greenwich Mean Time (GMT) as both a Lilian date and as the number of seconds since 00:00:00 14 October 1582. The returned values are compatible with those generated and used by the other date and time callable services.

CALL CEEGMT syntax

Read syntax diagramSkip visual syntax diagramCALL"CEEGMT"USINGoutput_GMT_Lilian,output_GMT_seconds,fc.
output_GMT_Lilian (output)
A 32-bit binary integer that represents the current date in Greenwich, England, in the Lilian format (the number of days since 14 October 1582).

For example, 16 May 1988 is day number 148138. If GMT is not available from the system, output_GMT_Lilian is set to 0 and CEEGMT terminates with a non-CEE000 symbolic feedback code.

output_GMT_seconds (output)
A 64-bit long floating-point number that represents the current date and time in Greenwich, England, as the number of seconds since 00:00:00 on 14 October 1582, not counting leap seconds.

For example, 00:00:01 on 15 October 1582 is second number 86,401 (24*60*60 + 01). 19:00:01.078 on 16 May 1988 is second number 12,799,191,601.078. If GMT is not available from the system, output_GMT_seconds is set to 0 and CEEGMT terminates with a non-CEE000 symbolic feedback code.

fc (output)
A 12-byte feedback code (optional) that indicates the result of this service.

Table 1. CEEGMT symbolic conditions
Symbolic feedback code Severity Message number Message text
CEE000 0 -- The service completed successfully.
CEE2E6 3 2502 The UTC/GMT was not available from the system.

Usage notes

  • CEEDATE converts output_GMT_Lilian to a character date, and CEEDATM converts output_GMT_seconds to a character time stamp.
  • In order for the results of this service to be meaningful, your system's clock must be set to the local time and the environment variable TZ must be set correctly.
  • The values returned by CEEGMT are handy for elapsed time calculations. For example, you can calculate the time elapsed between two calls to CEEGMT by calculating the differences between the returned values.
  • CEEUTC is identical to this service.

Example


*************************************************
**                                             **
** Function: Call CEEGMT to get current        **
**           Greenwich Mean Time               **
**                                             **
** In this example, a call is made to CEEGMT   **
** to return the current GMT as a Lilian date  **
** and as Lilian seconds. The results are      **
** displayed.                                  **
**                                             **
*************************************************
 IDENTIFICATION DIVISION.
 PROGRAM-ID. IGZTGMT.
 DATA DIVISION.
 WORKING-STORAGE SECTION.
 01  LILIAN                  PIC S9(9) BINARY.
 01  SECS                    COMP-2.
 01  FC.
     02  Condition-Token-Value.
     COPY  CEEIGZCT.
         03  Case-1-Condition-ID.
             04  Severity    PIC S9(4) COMP.
             04  Msg-No      PIC S9(4) COMP.
         03  Case-2-Condition-ID
                   REDEFINES Case-1-Condition-ID.
             04  Class-Code  PIC S9(4) COMP.
             04  Cause-Code  PIC S9(4) COMP.
         03  Case-Sev-Ctl    PIC X.
         03  Facility-ID     PIC XXX.
     02  I-S-Info            PIC S9(9) COMP.
 PROCEDURE DIVISION.
 PARA-CBLGMT.
     CALL 'CEEGMT' USING LILIAN , SECS , FC.

     IF CEE000 of FC  THEN
         DISPLAY 'The current GMT is also '
             'known as Lilian day: ' LILIAN
         DISPLAY 'The current GMT in Lilian '
             'seconds is: ' SECS
     ELSE
         DISPLAY 'CEEGMT failed with msg '
             Msg-No of FC UPON CONSOLE
         STOP RUN
     END-IF.

     GOBACK.

Related tasks   
Setting environment variables