From a83f70b6f8ade224a079a27b4f18fcb3fb0be0ca Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Sat, 1 Apr 2017 18:12:33 +0200 Subject: Use gettimeofday() instead of ftime() --- src/htslib.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) mode change 100644 => 100755 src/htslib.c diff --git a/src/htslib.c b/src/htslib.c old mode 100644 new mode 100755 index 40b79cc..f23d5e5 --- a/src/htslib.c +++ b/src/htslib.c @@ -68,7 +68,7 @@ Please visit our Website: http://www.httrack.com #include #include -#include +#include #include // pour utimbuf @@ -2575,11 +2575,13 @@ TStamp time_local(void) { // number of millisec since 1970 HTSEXT_API TStamp mtime_local(void) { #ifndef HTS_DO_NOT_USE_FTIME - struct timeb B; + struct timeval tv; + if (gettimeofday(&tv, NULL) != 0) { + assert(! "gettimeofday"); + } - ftime(&B); - return (TStamp) (((TStamp) B.time * (TStamp) 1000) - + ((TStamp) B.millitm)); + return (TStamp) (((TStamp) tv.tv_sec * (TStamp) 1000) + + ((TStamp) tv.tv_usec / (TStamp) 1000000)); #else // not precise.. return (TStamp) (((TStamp) time_local() * (TStamp) 1000) -- cgit v1.2.3