CEEGMTO: get offset from Greenwich Mean Time to local time
CEEGMTO returns values to the calling routine that represent the difference between the local system time and Greenwich Mean Time (GMT).
- offset_hours (output)
- A 32-bit binary integer that represents the offset from GMT to
local time, in hours.
For example, for Pacific Standard Time, offset_hours equals -8.
The range of offset_hours is -12 to +13 (+13 = daylight saving time in the +12 time zone).
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 that represents 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 long floating-point number that represents 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). The range of offset_seconds is -43,200 to +46,800. offset_seconds can be used with CEEGMT to calculate local date and time.
If the local time offset is not available from the system, offset_seconds is set to 0 and CEEGMTO terminates with a non-CEE000 symbolic feedback code.
- fc (output)
- A 12-byte feedback code (optional) that indicates the result of this service.
Symbolic feedback 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 converts offset_seconds to a character time stamp.
- In order for the results of this service to be meaningful, your system clock must be set to the local time, and the environment variable TZ must be set correctly.
Example
*************************************************
** **
** Function: 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) 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-CBLGMTO.
CALL 'CEEGMTO' USING HOURS , MINUTES ,
SECONDS , FC.
IF CEE000 of FC THEN
DISPLAY 'Local time differs from GMT '
'by: ' HOURS ' hours, '
MINUTES ' minutes, OR '
SECONDS ' seconds. '
ELSE
DISPLAY 'CEEGMTO failed with msg '
Msg-No of FC UPON CONSOLE
STOP RUN
END-IF.
GOBACK.