> I'd not expect two tokens left of "=". A cast? I'd expect "( ... )", and a > cast has no L-value.
It is a type declaration. Uint64_t is a type of integer, like long or short. Picture int mins = whatever; > Why do those names need to be different? Conway's law? Ask IBM, not David LOL! They just are. Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Paul Gilmartin Sent: Sunday, August 18, 2019 9:41 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Local time in C on z/OS On Sun, 18 Aug 2019 15:08:25 +0800, David Crayford wrote: >I once wrote some C code that sets the TZ, _TZ variables from the time >zone offset, leap second offset values in the CVT. > ... > // set the time zone offset and apply the leap second offset > int64_t ldto = cvt->cvtext2->cvtldto - cvt->cvtext2->cvtlso + adjust; > Is this intended to be used with localtime() and strftime()? Localtime() expects time() to have accounted for leap seconds, so they should not appear in TZ. An example on Linux (TZ value simulated by hand): 510 $ TZ=Asia/Calcutta date; TZ=GMT-5:29:33 date Sun Aug 18 21:45:02 IST 2019 Sun Aug 18 21:44:35 GMT 2019 ... I claim the former is correct. Also, the zone name, GMT, is wrong. Correct is IST. > ... > // if minutes have been specified then calculate them > uint64_t mins = ldto % STCK_UNIT_HOUR; > ( My C skill fails me. What kind of statement is that? An assignment? I'd not expect two tokens left of "=". A cast? I'd expect "( ... )", and a cast has no L-value. A declaration with initialization? It would be out of place. ) What happens if a DST transition, or even a leap second, occurs between such a setting of TZ and your program's formatting of current time? > ... > setenv("TZ", tzone, 1); // for POSIX > setenv("_TZ", tzone, 1); // for non-POSIX > Why do those names need to be different? Conway's law? A Modest Proposal: Isn't the HMC a PC running Linux? Shouldn't it have zoneinfo installed. Then the last line of each zoneinfo entry is the POSIX-formatted TZ string. Examples from my desktop Linux guest: 505 $ cd /usr/share/zoneinfo 506 $ tail -1 America/New_York EST5EDT,M3.2.0,M11.1.0 507 $ tail -1 Australia/Canberra AEST-10AEDT,M10.1.0,M4.1.0/3 512 $ tail -1 Asia/Calcutta IST-5:30 508 $ ls -l /etc/localtime lrwxrwxrwx 1 root root 34 Aug 15 17:46 /etc/localtime -> /usr/share/zoneinfo/America/Denver 509 $ tail -1 /etc/localtime MST7MDT,M3.2.0,M11.1.0 Wouldn't it be great if HMC passed such a string to z/OS UNIX at startup, to be used in formatting times elsewhere? The syntax is such that it could easily be parsed as a source for CVTLDTO, etc., so everything could be set once, consistently, in a human-friendly format, on the HMC. -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN