xiaoyin0208 / lz4

Automatically exported from code.google.com/p/lz4
0 stars 0 forks source link

ftime() obsolete, replace with gettimeofday() #39

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When compiling lz4 on NetBSD, the build fails because of the obsolete ftime() 
function. It still does exist on NetBSD, but you would have to link against 
-lcompat.
Even on Linux, the ftime man page says:
"This  function  is  obsolete.  Don't use it." and recommends gettimeofday() 
instead, which is provided by BSDs since 4.2BSD and has been added to the POSIX 
standard in 2001.

The attached patch replaces ftime() with over to gettimeofday().

Original issue reported on code.google.com by tk@giga.or.at on 23 Oct 2012 at 9:04

GoogleCodeExporter commented 8 years ago

Original comment by tk@giga.or.at on 23 Oct 2012 at 9:05

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for reporting. I'll look into it.
I'm slightly worried that i may get the opposite complaint
that some system may actually work fine with ftime() but not with 
gettimeofday().
It would be good to have a solution which works for both.

Original comment by yann.col...@gmail.com on 24 Oct 2012 at 12:23

GoogleCodeExporter commented 8 years ago
And there, it starts :
'sys/time.h' : unsupported by Visual

Original comment by yann.col...@gmail.com on 25 Oct 2012 at 9:46

GoogleCodeExporter commented 8 years ago
Here is a candidate version which tries to solve the issue and accomodate both 
worlds.
For the time being, only MSVC is redirected to legacy ftime() method.
I guess more systems could depend on it.

Original comment by yann.col...@gmail.com on 26 Oct 2012 at 12:49

Attachments:

GoogleCodeExporter commented 8 years ago
I've tried out this version with latest SVN (80) and it compiled fine, thank 
you!

Original comment by tk@giga.or.at on 26 Oct 2012 at 11:38

GoogleCodeExporter commented 8 years ago
Corrected into r81.

Original comment by yann.col...@gmail.com on 27 Oct 2012 at 6:28