summaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
Diffstat (limited to 'time')
-rw-r--r--time/unix/time.c6
-rw-r--r--time/win32/time.c20
2 files changed, 26 insertions, 0 deletions
diff --git a/time/unix/time.c b/time/unix/time.c
index 65b82b0aa..2669f30cf 100644
--- a/time/unix/time.c
+++ b/time/unix/time.c
@@ -364,6 +364,12 @@ APR_DECLARE(void) apr_unix_setup_time(void)
#endif
+/* A noop on all known Unix implementations */
+APR_DECLARE(void) apr_time_clock_hires(apr_pool_t *p)
+{
+ return;
+}
+
/* Deprecated */
APR_DECLARE(apr_status_t) apr_explode_time(apr_time_exp_t *result,
apr_time_t input,
diff --git a/time/win32/time.c b/time/win32/time.c
index 672b683cf..42b531b26 100644
--- a/time/win32/time.c
+++ b/time/win32/time.c
@@ -65,6 +65,7 @@
#endif
#include <string.h>
#include <winbase.h>
+#include "misc.h"
/* Leap year is any year divisible by four, but not by 100 unless also
* divisible by 400
@@ -282,6 +283,25 @@ APR_DECLARE(void) apr_sleep(apr_interval_time_t t)
Sleep((DWORD)(t / 1000));
}
+
+static apr_status_t clock_restore(void *unsetres)
+{
+ ULONG newRes;
+ SetTimerResolution((ULONG)unsetres, FALSE, &newRes);
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(void) apr_time_clock_hires(apr_pool_t *p)
+{
+ ULONG newRes;
+ if (SetTimerResolution(10000, TRUE, &newRes) == 0 /* STATUS_SUCCESS */) {
+ /* register the cleanup... */
+ apr_pool_cleanup_register(p, (void*)10000, clock_restore,
+ apr_pool_cleanup_null);
+ }
+}
+
+
/* Deprecated */
APR_DECLARE(apr_status_t) apr_explode_time(apr_time_exp_t *result,
apr_time_t input,