Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/apache2/mDNSResponder/dist/mDNSPosix Use clock_gett...
details: https://anonhg.NetBSD.org/src/rev/1cfeafe8b0cf
branches: trunk
changeset: 340941:1cfeafe8b0cf
user: roy <roy%NetBSD.org@localhost>
date: Mon Oct 12 09:26:38 2015 +0000
description:
Use clock_gettime as a more accurate time source.
diffstat:
external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diffs (23 lines):
diff -r 6c4789f14137 -r 1cfeafe8b0cf external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c
--- a/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c Mon Oct 12 05:43:25 2015 +0000
+++ b/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c Mon Oct 12 09:26:38 2015 +0000
@@ -1411,6 +1411,11 @@
mDNSexport mDNSs32 mDNSPlatformRawTime()
{
+#ifdef CLOCK_MONOTONIC
+ struct timespec tv;
+ clock_gettime(CLOCK_MONOTONIC, &tv);
+ return((tv.tv_sec << 10) | ((tv.tv_nsec / 1000) * 16 / 15625));
+#else
struct timeval tv;
gettimeofday(&tv, NULL);
// tv.tv_sec is seconds since 1st January 1970 (GMT, with no adjustment for daylight savings time)
@@ -1420,6 +1425,7 @@
// This gives us a proper modular (cyclic) counter that has a resolution of roughly 1ms (actually 1/1024 second)
// and correctly cycles every 2^22 seconds (4194304 seconds = approx 48 days).
return((tv.tv_sec << 10) | (tv.tv_usec * 16 / 15625));
+#endif
}
mDNSexport mDNSs32 mDNSPlatformUTC(void)
Home |
Main Index |
Thread Index |
Old Index