summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Roche <roche@httrack.com>2017-04-01 22:00:10 +0200
committerXavier Roche <roche@httrack.com>2017-04-01 22:00:10 +0200
commitf0da4dddc6f208be5862aac6e79bc311f1e696f3 (patch)
treec4f68ef2d0535571390dd662d18ed0a522bb22a0
parente6604bb233b9a1b7de589f071919111790feb6aa (diff)
Fixed ftime for Windows
-rw-r--r--src/htsglobal.h4
-rwxr-xr-xsrc/htslib.c11
2 files changed, 13 insertions, 2 deletions
diff --git a/src/htsglobal.h b/src/htsglobal.h
index 42e9b98..58c94b1 100644
--- a/src/htsglobal.h
+++ b/src/htsglobal.h
@@ -36,8 +36,8 @@ Please visit our Website: http://www.httrack.com
#define HTTRACK_GLOBAL_DEFH
// Version (also check external version information)
-#define HTTRACK_VERSION "3.48-24"
-#define HTTRACK_VERSIONID "3.48.24"
+#define HTTRACK_VERSION "3.49-1"
+#define HTTRACK_VERSIONID "3.49.1"
#define HTTRACK_AFF_VERSION "3.x"
#define HTTRACK_LIB_VERSION "2.0"
diff --git a/src/htslib.c b/src/htslib.c
index 54a98b0..92c7d44 100755
--- a/src/htslib.c
+++ b/src/htslib.c
@@ -68,7 +68,11 @@ Please visit our Website: http://www.httrack.com
#include <time.h>
#include <stdarg.h>
+#ifndef _WIN32
#include <sys/time.h>
+#else
+#include <sys/timeb.h>
+#endif
#include <fcntl.h>
// pour utimbuf
@@ -2575,6 +2579,7 @@ TStamp time_local(void) {
// number of millisec since 1970
HTSEXT_API TStamp mtime_local(void) {
#ifndef HTS_DO_NOT_USE_FTIME
+#ifndef _WIN32
struct timeval tv;
if (gettimeofday(&tv, NULL) != 0) {
assert(! "gettimeofday");
@@ -2583,6 +2588,12 @@ HTSEXT_API TStamp mtime_local(void) {
return (TStamp) (((TStamp) tv.tv_sec * (TStamp) 1000)
+ ((TStamp) tv.tv_usec / (TStamp) 1000000));
#else
+ struct timeb B;
+ ftime(&B);
+ return (TStamp) (((TStamp) B.time * (TStamp) 1000)
+ + ((TStamp) B.millitm));
+#endif
+#else
// not precise..
return (TStamp) (((TStamp) time_local() * (TStamp) 1000)
+ ((TStamp) 0));