Also, the CGHI would need to be an CGFI... but Glen's suggestion is better
(so AGFI would be the instruction to use).

sas

On Wed, Oct 28, 2015 at 5:11 PM, glen herrmannsfeldt <[email protected]>
wrote:

>
> > 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
>
> Seems easier to divide by 32000000 instead of shift and divide.
>
> Also, just add the 500000 before divide if you want rounding.
>
> By the way, time() is Posix, not C/C++.
>
> (That is, it ins't part of the C standard, but a separate standard.)
>
> Also, the usual epoch is different from the STCKE epoch, so add
> another constant for that one.  (Before or after divide.)
>
> -- glen
>
>
>


-- 
sas

Reply via email to