summaryrefslogtreecommitdiff
path: root/time/win32/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'time/win32/time.c')
-rw-r--r--time/win32/time.c20
1 files changed, 20 insertions, 0 deletions
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,