SRLG uses a "source" and "target" register as well as #bits.
STCKE MILLSECS
LG R1,MILLSECS # IGNORE SECOND DOUBLE WORD
SRLG R1,R1,5 # SCOOT RIGHT 5 BITS
DSGF R1,=F'1000000' # DIVIDE BY A MILLION
CGHI R0,500000 # COMPARE TO 1/2 MILLION
JL NOADD #DON'T ADD ONE TO RESULT
AGHI R1,1 # ROUND UP
NOADD DS 0H
STG R1,DOUBLETIME
Otherwise this should do the trick.
C-
Charles (Chuck) Hardee
Senior Systems Engineer/Database Administration
EAS Information Technology
Thermo Fisher Scientific
300 Industry Drive | Pittsburgh, PA 15275
Phone +1 (724) 517-2633 | Mobile +1 (412) 877-2809 | FAX: +1 (412) 490-9230
[email protected] | www.thermofisher.com
WORLDWIDE CONFIDENTIALITY NOTE: Dissemination, distribution or copying of this
e-mail or the information herein by anyone other than the intended recipient,
or an employee or agent of a system responsible for delivering the message to
the intended recipient, is prohibited. If you are not the intended recipient,
please inform the sender and delete all copies.
-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]] On
Behalf Of John McKown
Sent: Wednesday, October 28, 2015 4:13 PM
To: [email protected]
Subject: Re: Assembler callable analogue of C/C++ time()
From my reading, time() returns a integer which is "time in seconds since
EPOCH". What is wrong with using the assembler STCKE instruction to get the
104 bit TOD clock (in a 16 byte, double word aligned, field). Bit 51 of
this value is 0.000001 seconds since the z/OS epoch start. So, load bits
0..63 into a grande register with an LG. Then do an SRLG to "scoot"
everything over 5 bits. The resultant grande register has the time in
microseconds since epoch. So divide it by 1000000 and ignore the remainder
(or round if you want).
STCKE MILLSECS
LG R1,MILLSECS # IGNORE SECOND DOUBLE WORD
SRLG R1,5 # SCOOT RIGHT 5 BITS
DSGF R1,=F'1000000' # DIVIDE BY A MILLION
CGHI R0,500000 # COMPARE TO 1/2 MILLION
JL NOADD #DON'T ADD ONE TO RESULT
AGHI R1,1 # ROUND UP
NOADD DS 0H
STG R1,DOUBLETIME
* OR USE ST IF YOU'RE CERTAIN THAT THE RESULT IS VALID IN 32 BITS
...
MILLSECS DS 2D
The above should be close. Perhaps some other eyes will validate and
correct if necessary.
On Wed, Oct 28, 2015 at 9:12 AM, Paul Gilmartin <
[email protected]> wrote:
> (Cross-posting)
>
> In the Assembler Callable Services Reference, I find no analogue
> of the C/C++ time() function. Is there one? Am I looking in the
> wrong place? Is the programmer expected simply to use the C Library
> interface to call the C function?
>
> Thanks,
> gil
>
--
Schrodinger's backup: The condition of any backup is unknown until a
restore is attempted.
Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.
He's about as useful as a wax frying pan.
10 to the 12th power microphones = 1 Megaphone
Maranatha! <><
John McKown