On 2017-11-17, at 18:56:20, Charles Mills wrote:

> Okay, in response to absolutely no popular requests, here is how to convert
> a TOD to a UNIX time:
> 
> Add CVTLSO. There's your all-important leap seconds, affine or otherwise.
>  
Subtract?

> 
> ...to save a couple of cycles in the case of
> repetitive conversions you could adjust that constant for CVTLSO and only do
> one subtract.
>  
Taking care that CVTLSO hasn't changed midstream, which might devour the saving.
BTW, how does one ensure that CVTLSO hasn't changed between the STCK and the
access of CVTLSO?

> ...
> If the result is negative you are out of luck. The C library routines do not
> support negative times (times before 1/1/1970).
>  
I believe that (used to be) a POSIX requirement, but many non-IBM UNIXen
tolerate the violation.  In: 
    
http://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime.html#tag_16_299_05

ERRORS
    The localtime() [CX]   and localtime_r()   functions shall fail if:
 
    [EOVERFLOW]
    The result cannot be represented.

... no mention of negative argument.

This leaves the bugbear "-1", returned as an error by mktime().  But is
that 1969-12-31 23:59:59.  I suppose returned value is -1 but errno is 

> -----Original Message-----
> From: Paul Gilmartin
> Sent: Friday, November 17, 2017 7:14 AM
>> 
> That might be an affine transformation of STCK-CVTLSO.


-- gil

Reply via email to