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 Language Environment date and time services. In order for the results of this service to be meaningful, your system's TOD (time-of-day) clock must be set to Greenwich Mean Time and be based on the standard epoch. Use CEEGMTO to get the offset from GMT to local time.

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.

Language Environment treats Coordinated Universal Time (UTC) and Greenwich Mean Time (GMT) as the same. You can use the CEEUTC service, which is an alias of the CEEGMT service, to get the same value.

Read syntax diagramSkip visual syntax diagram
Syntax

>>-CEEGMT--(--output_GMT_Lilian--,--output_GMT_seconds--,--fc--->

>--)-----------------------------------------------------------><

output_GMT_Lilian (output)
A 32-bit binary integer representing the current time 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 double floating-point number representing 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 in some languages, that indicates the result of this service. If you choose to omit this parameter, refer to Invoking callable services for the appropriate syntax to indicate that the feedback code was omitted.

The following symbolic conditions can result from this service:

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 timestamp.
  • CICS® consideration—CEEGMT does not use the OS TIME macro.
  • z/OS UNIX consideration—In multithread applications, CEEGMT affects only the calling thread.
  • Setting the TOD (time-of-day) clock to anything before January 1, 1972 may produce unpredictable results in your applications.

For more information

Examples

  1. Following is an example of CEEGMT called by C/C++.
    /*Module/File Name: EDCGMT    */
    
    #include <string.h>
    #include <stdio.h>
    #include <leawi.h>
    #include <stdlib.h>
    #include <ceeedcct.h>
    
    int main(void) {
    
      _FEEDBACK fc;
      _INT4     lilGMT_date;
      _FLOAT8   secGMT_date;
    
      CEEGMT(&lilGMT_date,&secGMT_date,&fc);
      if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
         printf("CEEGMT failed with message number %d\n",
                fc.tok_msgno);
         exit(2999);
      }
      printf("The current Lilian date in Greenwich,");
      printf(" England is %d\n", lilGMT_date);
    }
  2. Following is an example of CEEGMT called by COBOL.
    CBL LIB,QUOTE
          *Module/File Name: IGZTGMT
          *************************************************
          **                                             **
          ** IGZTGMT - 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) BINARY.
                       04  Msg-No      PIC S9(4) BINARY.
                   03  Case-2-Condition-ID
                             REDEFINES Case-1-Condition-ID.
                       04  Class-Code  PIC S9(4) BINARY.
                       04  Cause-Code  PIC S9(4) BINARY.
                   03  Case-Sev-Ctl    PIC X.
                   03  Facility-ID     PIC XXX.
               02  I-S-Info            PIC S9(9) BINARY.
           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.
  3. Following is an example of CEEGMT called by PL/I.
    *PROCESS MACRO;
     /* Module/File Name: IBMGMT                         */
     /****************************************************/
     /**                                                **/
     /** Function: CEEGMT - get current Greenwich Mean  **/
     /**           Time                                 **/
     /** In this example, CEEGMT is called to return    **/
     /** the current Greenwich Mean Time as the number  **/
     /** of days and number of seconds since            **/
     /** 14 October 1582. The Lilian date is then       **/
     /**  printed.                                      **/
     /**                                                **/
     /****************************************************/
    
     PLICGMT: PROC OPTIONS(MAIN);
    
        %INCLUDE  CEEIBMAW;
        %INCLUDE  CEEIBMCT;
    
        DCL LILIAN   REAL FIXED BINARY(31,0);
        DCL SECONDS  REAL FLOAT DECIMAL(16);
        DCL 01 FC,                     /* Feedback token */
               03 MsgSev    REAL FIXED BINARY(15,0),
               03 MsgNo     REAL FIXED BINARY(15,0),
               03 Flags,
                  05 Case      BIT(2),
                  05 Severity  BIT(3),
                  05 Control   BIT(3),
               03 FacID     CHAR(3),      /* Facility ID */
               03 ISI   /* Instance-Specific Information */
                            REAL FIXED BINARY(31,0);
    
        /* Call CEEGMT to return current GMT as a        */
        /* Lilian date and Lilian seconds                */
        CALL CEEGMT ( LILIAN, SECONDS, FC );
    
        /* If CEEGMT ran successfully, print results     */
        IF  FBCHECK( FC, CEE000)  THEN  DO;
           PUT SKIP LIST( LILIAN ||
              ' days have passed since 14 October 1582.' );
           END;
        ELSE  DO;
           DISPLAY( 'CEEGMT  failed with msg '
              || FC.MsgNo );
           STOP;
           END;
    
     END PLICGMT;