diff --git a/include/time.h b/include/time.h index 51bee8fe771..3e1e2b4619e 100644 --- a/include/time.h +++ b/include/time.h @@ -1,4 +1,4 @@ -/* $OpenBSD: time.h,v 1.31 2018/10/30 16:28:42 guenther Exp $ */ +/* $OpenBSD: time.h,v 1.32 2022/10/25 16:30:30 millert Exp $ */ /* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */ /* @@ -44,6 +44,7 @@ #include #include #include +#include #ifndef _CLOCK_T_DEFINED_ #define _CLOCK_T_DEFINED_ @@ -68,21 +69,7 @@ typedef __size_t size_t; #define CLK_TCK 100 #endif -#define CLOCKS_PER_SEC 100 /* frequency of ticks reported by clock(). */ - -#if __POSIX_VISIBLE >= 199309 || __ISO_C_VISIBLE >= 2011 -#ifndef _TIMESPEC_DECLARED -#define _TIMESPEC_DECLARED -struct timespec { - time_t tv_sec; /* seconds */ - long tv_nsec; /* and nanoseconds */ -}; -#endif -#endif - #if __POSIX_VISIBLE >= 199309 -#include - #ifndef _CLOCKID_T_DEFINED_ #define _CLOCKID_T_DEFINED_ typedef __clockid_t clockid_t; diff --git a/sys/sys/_time.h b/sys/sys/_time.h index a8ac94e3a35..ce822225ac7 100644 --- a/sys/sys/_time.h +++ b/sys/sys/_time.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _time.h,v 1.9 2017/12/18 05:51:53 cheloha Exp $ */ +/* $OpenBSD: _time.h,v 1.10 2022/10/25 16:30:30 millert Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -32,12 +32,8 @@ #ifndef _SYS__TIME_H_ #define _SYS__TIME_H_ -#define CLOCK_REALTIME 0 -#define CLOCK_PROCESS_CPUTIME_ID 2 -#define CLOCK_MONOTONIC 3 -#define CLOCK_THREAD_CPUTIME_ID 4 -#define CLOCK_UPTIME 5 -#define CLOCK_BOOTTIME 6 +/* Frequency of ticks reported by clock(). */ +#define CLOCKS_PER_SEC 100 #if __BSD_VISIBLE /* @@ -49,6 +45,29 @@ #define __CLOCK_PTID(c) (((c) >> 12) & 0xfffff) #endif +#if __POSIX_VISIBLE >= 199309 || __ISO_C_VISIBLE >= 2011 +#ifndef _TIME_T_DEFINED_ +#define _TIME_T_DEFINED_ +typedef __time_t time_t; +#endif + +#ifndef _TIMESPEC_DECLARED +#define _TIMESPEC_DECLARED +struct timespec { + time_t tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ +}; +#endif +#endif + +#if __POSIX_VISIBLE >= 199309 +#define CLOCK_REALTIME 0 +#define CLOCK_PROCESS_CPUTIME_ID 2 +#define CLOCK_MONOTONIC 3 +#define CLOCK_THREAD_CPUTIME_ID 4 +#define CLOCK_UPTIME 5 +#define CLOCK_BOOTTIME 6 + /* * Structure defined by POSIX 1003.1b to be like a itimerval, * but with timespecs. Used in the timer_*() system calls. @@ -61,4 +80,6 @@ struct itimerspec { #define TIMER_RELTIME 0x0 /* relative timer */ #define TIMER_ABSTIME 0x1 /* absolute timer */ +#endif + #endif /* !_SYS__TIME_H_ */