Mon Sep 19 22:30:19 2022 UTC ()
Reference kernel-wide hz constant instead of using a private but possibly
different value.


(mlelstv)
diff -r1.13 -r1.14 src/external/cddl/osnet/sys/sys/time.h

cvs diff -r1.13 -r1.14 src/external/cddl/osnet/sys/sys/time.h (expand / switch to unified diff)

--- src/external/cddl/osnet/sys/sys/time.h 2021/08/29 08:43:12 1.13
+++ src/external/cddl/osnet/sys/sys/time.h 2022/09/19 22:30:19 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: time.h,v 1.13 2021/08/29 08:43:12 christos Exp $ */ 1/* $NetBSD: time.h,v 1.14 2022/09/19 22:30:19 mlelstv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> 4 * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -72,27 +72,27 @@ gethrtime(void) { @@ -72,27 +72,27 @@ gethrtime(void) {
72 getnanouptime(&ts); 72 getnanouptime(&ts);
73 nsec = (hrtime_t)ts.tv_sec * NANOSEC + ts.tv_nsec; 73 nsec = (hrtime_t)ts.tv_sec * NANOSEC + ts.tv_nsec;
74 return (nsec); 74 return (nsec);
75} 75}
76 76
77#define gethrestime_sec() (time_second) 77#define gethrestime_sec() (time_second)
78#define gethrestime(ts) getnanotime(ts) 78#define gethrestime(ts) getnanotime(ts)
79#define gethrtime_waitfree() gethrtime() 79#define gethrtime_waitfree() gethrtime()
80 80
81static inline int64_t 81static inline int64_t
82ddi_get_lbolt64(void) 82ddi_get_lbolt64(void)
83{ 83{
84 struct timespec ts; 84 struct timespec ts;
85 const int hz = 100; 85 extern int hz;
86 86
87 getnanouptime(&ts); 87 getnanouptime(&ts);
88 return (int64_t)(SEC_TO_TICK(ts.tv_sec) + NSEC_TO_TICK(ts.tv_nsec)); 88 return (int64_t)(SEC_TO_TICK(ts.tv_sec) + NSEC_TO_TICK(ts.tv_nsec));
89} 89}
90 90
91#define ddi_get_lbolt() (clock_t)ddi_get_lbolt64() 91#define ddi_get_lbolt() (clock_t)ddi_get_lbolt64()
92 92
93#else 93#else
94 94
95#ifdef __NetBSD__ 95#ifdef __NetBSD__
96int clock_gettime(clockid_t, struct timespec *) 96int clock_gettime(clockid_t, struct timespec *)
97 __RENAME(__clock_gettime50); 97 __RENAME(__clock_gettime50);
98#endif 98#endif