summaryrefslogtreecommitdiff
path: root/src/common/compat_time.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-07-08 10:38:59 -0400
committerNick Mathewson <nickm@torproject.org>2016-07-08 10:38:59 -0400
commitaa971c59246332391116caafd18855bccf2f99a5 (patch)
tree1877795b7f3fe57cf6b6d918017433fbabcefb57 /src/common/compat_time.h
parent3ac434104af0a40e75bfb5116046eae1cd51f6d3 (diff)
downloadtor-aa971c59246332391116caafd18855bccf2f99a5.tar.gz
tor-aa971c59246332391116caafd18855bccf2f99a5.zip
Move our "what time is it now" compat functions into a new module
I'm not moving our "format and parse the time" functions, since those have been pretty volatile over the last couple of years.
Diffstat (limited to 'src/common/compat_time.h')
-rw-r--r--src/common/compat_time.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/common/compat_time.h b/src/common/compat_time.h
new file mode 100644
index 0000000000..56126ba84c
--- /dev/null
+++ b/src/common/compat_time.h
@@ -0,0 +1,26 @@
+/* Copyright (c) 2003-2004, Roger Dingledine
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2016, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef TOR_COMPAT_TIME_H
+#define TOR_COMPAT_TIME_H
+
+#include "orconfig.h"
+
+#if !defined(HAVE_GETTIMEOFDAY) && !defined(HAVE_STRUCT_TIMEVAL_TV_SEC)
+/** Implementation of timeval for platforms that don't have it. */
+struct timeval {
+ time_t tv_sec;
+ unsigned int tv_usec;
+};
+#endif
+
+void tor_gettimeofday(struct timeval *timeval);
+
+#ifdef TOR_UNIT_TESTS
+void tor_sleep_msec(int msec);
+#endif
+
+#endif
+