On Thu, 12 Nov 2020 16:13:41 +1100, Attila Fogarasi wrote:
>Hercules emulates the TOD clock, so what you see is Hercules behaviour and
>not the real hardware behaviour for any particular machine type.
>
Yes. And I suspect H merely naively converts the Linux(?) system clock
to TOD format (add 1970 years; etc.)
>
>On Thu, Nov 12, 2020 at 2:13 PM Rupert Reynolds wrote:
>
>> I did look for IBM docs online, but I haven't found anything very helpful.
>>
You have probably read "TOD Programmable Register" in recent PoOp.
>> I read of someone using STCK and converting (the hard way!) to display
>> time, instead of using TIME DEC. So I tried it on my Hercules/MVS 3.8
>> setup.
>>
Officially, z/OS keeps a leap second count in CVTLSO and *subtracts* that
from TOD to get UTC and adds CVTLDTO to get local time. What value
do you see for CVTLSO/4096/1000000? (Oops! Does 3.8 have a CVTLSO?)
At an ordinary leap second z/OS adds 1 second to CVTLSO (there has never
been a negative leap second.)
https://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat
https://www.iana.org/time-zones
During that leap second z/OS makes user processes nondispatchable so callers
of TIME do not see anachronistic results. No z/OS internals expert has ever
come forth in this forum to explain how TIME accounts for the minuscule
timing window that CVTLSO/CVTLDTO might be accessed and STCK performed
on opposite sides of a leap second or DST boundary.
Years ago, our site encountered two software products (both from IBM, IIRC)
that had different notions of whether to apply CVTLSO, resulting in several
seconds' inconsistency in SMF data. We turned off leap seconds; set
CVTLSO=0 and stayed that way ever after.
I'll attempt to attach a C program that displays TAI rather than UTC.
-- gil
/* ********************************************************** */
/* Doc: Display TAI.
BUGS: Requires /usr/share/zoneinfo/right.
Will never display 23:59:60. */
#include <stdlib.h>
#include <langinfo.h>
#include <stdio.h>
#include <sys/types.h>
#include <time.h>
int main( int argc, char **argv ) {
char *format;
time_t t;
char str[ 99 ];
size_t len;
struct tm timestruc;
/* Use either argument as format or (volatile) environment string.
*/
format = argv[ 1 ] ? argv[ 1 ]
: nl_langinfo( D_T_FMT );
/* get system time; convert to (UTC) struct tm.
*/
t = time( &t );
putenv( "TZ=Etc/Zulu"); /* Assume this indicates TAI vs. UTC. */
tzset();
gmtime_r( &t, ×truc );
len = strftime( str, sizeof( str ) -1, format, ×truc );
/* Convert struct tm to atomic time.
*/
putenv( "TZ=right/Etc/Zulu");
tzset();
t = mktime( ×truc );
t = t + 10; /* (10-second bias when UTC began in 1972.) */
/* Convert; format; and display.
*/
putenv( "TZ=posix/Etc/Zulu");
tzset();
gmtime_r( &t, ×truc );
len = strftime( str, sizeof( str ) -1, format, ×truc );
printf( "%s\n", str );
return( 0 ); }
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN