diff options
Diffstat (limited to 'src/htslib.c')
-rwxr-xr-x[-rw-r--r--] | src/htslib.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/htslib.c b/src/htslib.c index 40b79cc..f23d5e5 100644..100755 --- a/src/htslib.c +++ b/src/htslib.c @@ -68,7 +68,7 @@ Please visit our Website: http://www.httrack.com #include <time.h> #include <stdarg.h> -#include <sys/timeb.h> +#include <sys/time.h> #include <fcntl.h> // 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) |