summaryrefslogtreecommitdiffstats
path: root/otime.h
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-04-13 09:48:11 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-04-13 09:48:11 +0000
commit428b82796705988239c4c7f09dc6a89c22a8e615 (patch)
treed07301f0f9692d6878913d2a263fd105a079423c /otime.h
parentf84f536b05be7530c876f0e665a133eae6e6b502 (diff)
downloadopenvpn-428b82796705988239c4c7f09dc6a89c22a8e615.tar.gz
openvpn-428b82796705988239c4c7f09dc6a89c22a8e615.tar.xz
openvpn-428b82796705988239c4c7f09dc6a89c22a8e615.zip
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.h37
1 files changed, 7 insertions, 30 deletions
diff --git a/otime.h b/otime.h
index 6744c4d..2dca396 100644
--- a/otime.h
+++ b/otime.h
@@ -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)
{