diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/htsglobal.h | 4 | ||||
-rw-r--r-- | src/htslib.c | 19 | ||||
-rw-r--r-- | src/proxy/proxytrack.h | 18 |
3 files changed, 6 insertions, 35 deletions
diff --git a/src/htsglobal.h b/src/htsglobal.h index 94a2c4a..2501520 100644 --- a/src/htsglobal.h +++ b/src/htsglobal.h @@ -93,10 +93,6 @@ Please visit our Website: http://www.httrack.com #include "config.h" -#ifndef FTIME -#define HTS_DO_NOT_USE_FTIME -#endif - #ifndef SETUID #define HTS_DO_NOT_USE_UID #endif diff --git a/src/htslib.c b/src/htslib.c index 1df4765..d19b3af 100644 --- a/src/htslib.c +++ b/src/htslib.c @@ -2602,7 +2602,6 @@ 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) { @@ -2617,11 +2616,6 @@ HTSEXT_API TStamp mtime_local(void) { return (TStamp) (((TStamp) B.time * (TStamp) 1000) + ((TStamp) B.millitm)); #endif -#else - // not precise.. - return (TStamp) (((TStamp) time_local() * (TStamp) 1000) - + ((TStamp) 0)); -#endif } // convertit un nombre de secondes en temps (chaine) @@ -2784,18 +2778,13 @@ struct tm *convert_time_rfc822(struct tm *result, const char *s) { return NULL; } -static time_t getGMT(struct tm *tm) { /* hey, time_t is local! */ - time_t t = mktime(tm); +static time_t getGMT(struct tm *tm) { + time_t t = timegm(tm); if (t != (time_t) - 1 && t != (time_t) 0) { - /* BSD does not have static "timezone" declared */ -#if (defined(BSD) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD_kernel__)) - time_t now = time(NULL); - time_t timezone = -localtime(&now)->tm_gmtoff; -#endif - return (time_t) (t - timezone); + return (time_t) t; } - return (time_t) - 1; + return (time_t) -1; } /* sets file time. -1 if error */ diff --git a/src/proxy/proxytrack.h b/src/proxy/proxytrack.h index c8fc57d..e288e50 100644 --- a/src/proxy/proxytrack.h +++ b/src/proxy/proxytrack.h @@ -35,20 +35,16 @@ Please visit our Website: http://www.httrack.com #include "store.h" #include <sys/stat.h> -#ifndef HTS_DO_NOT_USE_FTIME #ifdef _WIN32 #include <sys/utime.h> #else #include <utime.h> #endif #include <sys/timeb.h> -#else -#include <utime.h> -#endif #ifndef _WIN32 #include <pthread.h> #endif -#include <stdarg.h>
+#include <stdarg.h> /* generic */ @@ -378,17 +374,7 @@ HTS_UNUSED static struct tm PT_GetTime(time_t t) { HTS_UNUSED static int set_filetime(const char *file, struct tm *tm_time) { struct utimbuf tim; -#ifndef HTS_DO_NOT_USE_FTIME - struct timeb B; - - memset(&B, 0, sizeof(B)); - B.timezone = 0; - ftime(&B); - tim.actime = tim.modtime = mktime(tm_time) - B.timezone * 60; -#else - // bogus time (GMT/local).. - tim.actime = tim.modtime = mktime(tm_time); -#endif + tim.actime = tim.modtime = timegm(tm_time); return utime(file, &tim); } HTS_UNUSED static int set_filetime_time_t(const char *file, time_t t) { |