NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: sys/clock.h
[ +current-users@ with full-quote for context ]
> It looks like in order to be able to use sys/clock.h,
> one needs to first include either inttypes.h or
> stdint.h _before_ sys/clock.h.
>
> I've long made it a habit of sorting includes
> alphabetically and according to /usr/share/misc/style,
> which requires 'sys' includes to come before others,
> but that leads to
>
> /usr/include/sys/clock.h:72:14: error: unknown type name 'uint64_t'
> 72 | is_leap_year(uint64_t year)
> | ^~~~~~~~
> /usr/include/sys/clock.h:84:15: error: unknown type name 'uint64_t'
> 84 | days_per_year(uint64_t year)
> | ^~~~~~~~
>
> Should sys/clock.h itself include the headers it
> actually needs for the inline function implementations
> it provides?
Per tnn@'s suggestion, does the attached diff look ok?
-Jan
Index: clock.h
===================================================================
RCS file: /cvsroot/src/sys/sys/clock.h,v
retrieving revision 1.4
diff -u -p -r1.4 clock.h
--- clock.h 19 Apr 2018 21:19:07 -0000 1.4
+++ clock.h 24 Oct 2023 18:13:20 -0000
@@ -32,6 +32,10 @@
#ifndef _SYS_CLOCK_H_
#define _SYS_CLOCK_H_
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <stdint.h>
+#endif
+
/* Some handy constants. */
#define SECS_PER_MINUTE 60
#define SECS_PER_HOUR 3600
Home |
Main Index |
Thread Index |
Old Index