summaryrefslogtreecommitdiff
path: root/src/htslib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/htslib.c')
-rwxr-xr-x[-rw-r--r--]src/htslib.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/htslib.c b/src/htslib.c
index 40b79cc..54a98b0 100644..100755
--- a/src/htslib.c
+++ b/src/htslib.c
@@ -1,7 +1,7 @@
/* ------------------------------------------------------------ */
/*
HTTrack Website Copier, Offline Browser for Windows and Unix
-Copyright (C) 1998-2016 Xavier Roche and other contributors
+Copyright (C) 1998-2017 Xavier Roche and other contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -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)