On May 16, 2011, at 14:03, Dougie Lawson wrote: > > CVTLDTO gives you the offset, CVTLSO is the number of leap seconds. > > LG R1,StckTimeStamp > ALG R1,CVTLDTO > SLG R1,CVTLSO > STG R1,LocalTime > But be careful. If an interrupt occurs between the STCK and the offsetting arithmetic, and while your task is not dispatched CVTLDTO and/or CVTLSO are updated by the system, your computed value may be in error by up to an hour. Highly unlikely, but similarly difficult to diagnose or reproduce.
The only safe approach I see is either to wrap the whole sequence with PLO, or: LOOP Fetch both CVTLDTO and CVTLSO into registers. STCK Compare register values to CVT values BNE LOOP Perform offsetting arithmetic. I see a similar hazard if time and date are obtained in separate system calls straddling midnight: the aggregate value may be in error by up to 23:59:59. Is there a single system call which retrieves both date and time in an atomic fashion, guaranteeing consistency? --gil