diff options
author | Xavier Roche <roche@httrack.com> | 2017-04-01 22:00:10 +0200 |
---|---|---|
committer | Xavier Roche <roche@httrack.com> | 2017-04-01 22:00:10 +0200 |
commit | f0da4dddc6f208be5862aac6e79bc311f1e696f3 (patch) | |
tree | c4f68ef2d0535571390dd662d18ed0a522bb22a0 /src/htslib.c | |
parent | e6604bb233b9a1b7de589f071919111790feb6aa (diff) |
Fixed ftime for Windows
Diffstat (limited to 'src/htslib.c')
-rwxr-xr-x | src/htslib.c | 11 |
1 files changed, 11 insertions, 0 deletions
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)); |