0

A "date" command on USS says:

Wed Jan 22 17:51:30 EST 2014

A couple of seconds later, a TSO TIME command says:

IKJ56650I TIME-04:51:58 PM. CPU-00:00:02 SERVICE-196896 SESSION-07:08:30 JANUARY 22,2014

(There's a one-hour time zone difference.) TSO TIME tracks, via eyeball, very closely to the time in system log entries. Any idea why the "date" command might be 28 seconds off?

Thanks.

Singlestone
  • 2,019
  • 3
  • 16
  • 18
  • Have you checked the TZ global variable in /etc/profile and/or /$home/.profile? It might be set to the wrong time zone. Check out time zone settings in [this Red Book](http://www.redbooks.ibm.com/redbooks/pdfs/sg246989.pdf‎) – NealB Jan 23 '14 at 01:09
  • I changed TZ to CST6CDT to match the time zone. There's still about a 30-second difference between date and TSO TIME. – Singlestone Jan 23 '14 at 17:33
  • Can you look at the CVT and get the values of CVTLDTO and CVTLSO? – zarchasmpgmr Jan 30 '14 at 00:43
  • I could, @zarchasmpgmr, but how would that explain the difference? Do you mean that date and TSO TIME use those fields differently when they calculate the current time? – Singlestone Jan 30 '14 at 19:24
  • I've seen strange things before in the way USS is implemented. It's more for curiosity's sake. – zarchasmpgmr Feb 02 '14 at 00:06

1 Answers1

2

The difference is due to the handling of leap-seconds. Applications that merely access the hardware clock directly (STCK/STCKE instructions) often forget about leap-seconds, and so they will be off by about 30 seconds. Smarter apps use system time conversion routines that factor in leap-seconds automatically. Here's an example of how this happens: http://www-01.ibm.com/support/docview.wss?uid=isg1OA41950

Having said that, POSIX or the Single Unix Specification (which z/OS UNIX Services adheres to) may in fact specify the behavior of the "date" command. Here's what SUS says under "Seconds Since the Epoch":

A value that approximates the number of seconds that have elapsed since the Epoch...As represented in seconds since the Epoch, each and every day shall be accounted for by exactly 86400 seconds.

By my reading, the comment about every day having exactly 86400 seconds suggests that the UNIX specification intentionally does not want leap seconds counted. If this is the case, then IBM is merely following the letter of the law with respect to how the time is displayed.

Valerie R
  • 1,769
  • 9
  • 29