diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2006-04-13 09:48:11 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2006-04-13 09:48:11 +0000 |
commit | 428b82796705988239c4c7f09dc6a89c22a8e615 (patch) | |
tree | d07301f0f9692d6878913d2a263fd105a079423c /otime.h | |
parent | Version 2.1_beta13 released (diff) | |
download | openvpn-428b82796705988239c4c7f09dc6a89c22a8e615.tar.xz |
Temporarily backed out time backtrack handling code
due to issues on Windows.
Rewrote gettimeofday function for Windows to be
simpler and more efficient.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@1005 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'otime.h')
-rw-r--r-- | otime.h | 37 |
1 files changed, 7 insertions, 30 deletions
@@ -56,44 +56,23 @@ const char *tv_string_abs (const struct timeval *tv, struct gc_arena *gc); extern time_t now; /* updated frequently to time(NULL) */ -#if TIME_BACKTRACK_PROTECTION - -void update_now (const time_t system_time); +void time_test (void); static inline void update_time (void) { - update_now (time (NULL)); -} - -#ifdef HAVE_GETTIMEOFDAY - -extern time_t now_usec; -void update_now_usec (struct timeval *tv); - -static inline int -openvpn_gettimeofday (struct timeval *tv, void *tz) -{ - const int status = gettimeofday (tv, tz); - if (!status) +#if defined(WIN32) && defined(HAVE_GETTIMEOFDAY) + struct timeval tv; + if (!gettimeofday (&tv, NULL)) { - update_now_usec (tv); - tv->tv_sec = now; - tv->tv_usec = now_usec; + if (tv.tv_sec != now) + now = tv.tv_sec; } - return status; -} - -#endif - #else - -static inline void -update_time (void) -{ const time_t real_time = time (NULL); if (real_time != now) now = real_time; +#endif } #ifdef HAVE_GETTIMEOFDAY @@ -106,8 +85,6 @@ openvpn_gettimeofday (struct timeval *tv, void *tz) #endif -#endif - static inline time_t openvpn_time (time_t *t) { |