SwiftWarrior
SwiftWarrior

Reputation: 1964

How to obtain UTC value in zOS assembler

I'm aware that the STCK instruction will give me a TOD value which is the time that has passed since 1-1-1900. How can I get the UTC time that has passed since 1-1-1970?

Upvotes: 0

Views: 297

Answers (1)

cschneid
cschneid

Reputation: 10765

If your Assembler code is LE-conforming (i.e. you use the CEEENTRY entry logic and its attendant macros) you can call C library functions such as time() or time64() to get your desired result.

If you cannot make your code LE-conforming for some reason, I suggest the TIME macro, specifying BIN format and ZONE=UTC, then calculate the offset from midnight 01-Jan-1970 by subtracting the difference between that time/date and the basis for the Time Of Day clock which is midnight 01-Jan-1900. It's a constant, of course, so you only have to figure that out once. I used this calculator and got 2,208,988,800 as the constant. Note that TIME BIN returns a 32 bit integer indicating number of hundredths of a second since the epoch.

Upvotes: 1

Related Questions