CEEGMTO—Get offset from Greenwich Mean Time to local time
CEEGMTO returns values to the calling routine representing the difference between the local system time and Greenwich Mean Time (GMT).
Syntax >>-CEEGMTO--(--offset_hours--,--offset_minutes--,---------------> >--offset_seconds--,--fc--)------------------------------------><
- offset_hours (output)
- A 32-bit binary integer representing the offset from GMT to local time, in hours. For example, for Pacific Standard Time, offset_hours equals -8. If local time offset is not available, offset_hours equals 0 and CEEGMTO terminates with a non-CEE000 symbolic feedback code.
- offset_minutes (output)
- A 32-bit binary integer representing the number of additional minutes that local time is ahead of or behind GMT. The range of offset_minutes is 0 to 59. If the local time offset is not available, offset_minutes equals 0 and CEEGMTO terminates with a non-CEE000 symbolic feedback code.
- offset_seconds (output)
- A 64-bit double floating-point number representing the offset from GMT to local time, in seconds. For example, Pacific Standard Time is eight hours behind GMT. If local time is in the Pacific time zone during standard time, CEEGMTO would return -28,800 (-8 * 60 * 60). offset_seconds can be used with CEEGMT to calculate local date and time. See CEEGMT—Get current Greenwich Mean Time for more information.
- 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. CEE2E7 3 2503 The offset from UTC/GMT to local time was not available from the system.
Usage notes
- CEEDATM is used to convert number of seconds to a character timestamp.
- CICS® consideration—CEEGMTO does not use the OS TIME macro.
- z/OS UNIX consideration—In multithread applications, CEEGMTO affects only the calling thread.
For more information
- See CEEDATM—Convert seconds to character timestamp for more information about the CEEDATM callable service.
Examples
- An example of CEEGMTO called by C/C++:
/*Module/File Name: EDCGMTO */ #include <string.h> #include <stdio.h> #include <leawi.h> #include <stdlib.h> #include <ceeedcct.h> int main(void) { _FEEDBACK fc; _INT4 GMT_hours,GMT_mins; _FLOAT8 GMT_secs; CEEGMTO(&GMT_hours,&GMT_mins,&GMT_secs,&fc); if ( _FBCHECK ( fc , CEE000 ) != 0 ) { printf("CEEGMTO failed with message number %d\n", fc.tok_msgno); exit(2999); } printf("The difference between GMT and the local "); printf("time is:\n"); printf("%d hours, %d minutes\n",GMT_hours,GMT_mins); }
- An example of CEEGMTO called by COBOL:
CBL LIB,QUOTE *Module/File Name: IGZTGMTO ************************************************* ** ** ** IGZTGMTO - Call CEEGMTO to get offset from ** ** Greenwich Mean Time to local ** ** time ** ** ** ** In this example, a call is made to CEEGMTO ** ** to return the offset from GMT to local time ** ** as separate binary integers representing ** ** offset hours, minutes, and seconds. The ** ** results are displayed. ** ** ** ************************************************* IDENTIFICATION DIVISION. PROGRAM-ID. IGZTGMTO. DATA DIVISION. WORKING-STORAGE SECTION. 01 HOURS PIC S9(9) BINARY. 01 MINUTES PIC S9(9) BINARY. 01 SECONDS 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-CBLGMTO. CALL "CEEGMTO" USING HOURS , MINUTES , SECONDS , FC. IF CEE000 of FC THEN DISPLAY "Local time differs from GMT " "by: " HOURS " hours, " MINUTES " minutes, and " SECONDS " seconds. " ELSE DISPLAY "CEEGMTO failed with msg " Msg-No of FC UPON CONSOLE STOP RUN END-IF. GOBACK.
- An example of CEEGMTO called by PL/I:
*PROCESS MACRO; /* Module/File Name: IBMGMTO */ /****************************************************/ /** **/ /** Function: CEEGMTO - get the offset from **/ /** Greenwich Mean Time **/ /** to local time **/ /** **/ /****************************************************/ PLIGMTO: PROC OPTIONS(MAIN); %INCLUDE CEEIBMAW; %INCLUDE CEEIBMCT; DCL HOURS REAL FIXED BINARY(31,0); DCL MINUTES 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 CEEGMTO to return hours, minutes, and */ /* seconds that local time is offset from GMT */ CALL CEEGMTO ( HOURS, MINUTES, SECONDS, FC ); /* If CEEGMTO ran successfully, print results */ IF FBCHECK( FC, CEE000) THEN DO; PUT SKIP EDIT('The difference between GMT and ' || 'local time is ', HOURS, ':', MINUTES ) (A, P'S99', A, P'99' ); END; ELSE DO; DISPLAY( 'CEEGMTO failed with msg ' || FC.MsgNo ); STOP; END; END PLIGMTO;