Bill's suggestion is a vast improvement. But I can't understand why IBM publishes examples that seem to be written (by a student) for System/360. Not to mention that actually dividing by 2 was naive even then.
Convert the code to use this new thing, 64-bit registers, and you'll need half the instructions and none of the silly games. sas On Tue, Jul 18, 2017 at 10:18 PM, Bill Godfrey <[email protected]> wrote: > The number of seconds per TOD unit is too large to be represented in a > signed fullword, but half the number of seconds is not too large. > So they break the computation into 2 divides. > > When the STCK value is hex ba9a048bca000000 (January 10 2004 13:37:05) or > larger, the value after subtracting EPOCJ70 is hex 3D09000000000000, and a > fixed-point divide exception occurs on the divide instruction. This is when > the Unix time rolled over to hex 40000000. > > Since dividing by hex 7a120000 (decimal 2048000000) and then by 2 is the > same as dividing by 4096 and then by 1 million, one way to avoid the divide > exception is to replace the 4 instructions with these two: > > SRDL R14,12 DIVIDE BY 4096 > D R14,=F'1000000' > > Bill > > On Tue, 18 Jul 2017 10:28:38 -0500, Kirk Wolf wrote: > > >Oh I get it now - Unix epoch second times are 32 bit *signed* integers. > >So, they are doing SLR 14,14 prior to dividing by two to truncate at a > >(signed) 31-bit integer. > > > >0x7FFFFFFF is Jan 19, 2038 (UTC), the latest time that can be represented > >as a 32-bit signed integer seconds. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
