Building on Windows from scratch - difftime problem found ( was datediff )

Gary Bilkus mail at gary.bilkus.com
Sat Jan 25 08:49:33 EST 2014


On 24/01/2014 17:08, Derek Atkins wrote:
> John Ralls <jralls at ceridwen.us> writes:
>
>> if (sizeof(time_t) == 8)
>>    return (double)((int64)time1 - (int64)time2);
>> else
>>    return (double)((int32)time1 - (int32)time2);
> This code probably wouldn't compile cleanly.  It would complain about
> casting to different sizes.  Even though theoretically the compiler
> should be able to optimize the branch by noticing that it is always true
> or always false, it will still complain about the unused branch.  (I
> know this from personal experience).
>
>> That could be done as a macro and inserted into one of the header
>> files in each library.
>>
>> Regards,
>> John Ralls
> -derek
>
Given that time_t is always a signed integer value, wouldn't

return (double)(time1-time2)

just work anyway, at least as far as a patch for mingw is concerned?


More information about the gnucash-devel mailing list