Wireshark-dev: Re: [Wireshark-dev] Time shift patch causes compile error
From: Dirk Jagdmann <doj@xxxxxxxxx>
Date: Mon, 15 Aug 2011 20:34:19 -0700
> I'm not sure if my system config or the code is at fault. truncl isn't
> defined anywhere in /usr/include/* except for C++ header files.
> Apparently, it's a gcc builtin function. I have no idea what parameters
> it expects. You're passing it long doubles, this is in line with the
> manpage.
> 
> If I enable your define for windows
> 
> #define truncl(ld) floorl(ld)
> 
> things work ok for me. Should that be enabled for older gccs as well or
> are you aware of gcc settings that make it define truncl() in the standard
> way?

I put in this #define to make it work on Windows, but did not check too much
where the trunc() function is available elsewhere. I also think that if truncl()
is not present on other non-Windows platform, we should simply use floorl(), as
it should be available on every C compiler. floor() and trunc() only return a
different result for negative arguments. (truncl always rounds down, floorl
round towards 0)

Would could also declare the offset_float variable as "double" and use "floor()"
instead, possibly being more compatible if a platform does not support the "long
double" format. And 64bit of double should be enough for a nanosecond precision.

-- 
---> Dirk Jagdmann
----> http://cubic.org/~doj
-----> http://llg.cubic.org