[tz] localtime.c issue

Ian Abbott abbotti at mev.co.uk
Tue Jul 9 13:53:45 UTC 2013


On 2013-07-09 11:06, Ian Abbott wrote:
> On 2013-07-08 21:09, Andy Heninger wrote:
>> This compilation error from the localtime.c in 2013d looks like an
>> actual problem. I think time_t is generally an integer type of some sort.
>>
>> Built using the clang compiler on Linux.
>>
>> localtime.c:1517:34: error: implicit conversion from 'double' to
>> 'time_t' (aka 'long') changes value from 0.5 to 0
>> [-Werror,-Wliteral-conversion]
>>                  register time_t         half_second = 0.5;
>>                                          ~~~~~~~~~~~   ^~~
>> 1 error generated.
>>
>> Thanks,
>>    -- Andy Heninger
>
> How about just changing it from an implicit conversion to an explicit one?
>
>      register time_t half_second = (time_t)0.5;
>
> ?

I've just tested that with

   make CC=clang CFLAGS="-Werror -Wall"

It seems to work.  But Paul has already fixed it with the double_to_time 
function, so my fix is superfluous.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-


More information about the tz mailing list