From 03d4ce367aefe4a0f045118bca4c15d5a60b5cdd Mon Sep 17 00:00:00 2001 From: kettenis <> Date: Mon, 7 May 2012 22:34:00 +0000 Subject: [PATCH] Once more the people behind POSIX didn't think and put clock_gettime(2) and friends in . The kernel needs access to the associated #defines, but can't get them from , so introduce a new header and include that from for userland and for the kernel. ok matthew@, guenther@, millert@ --- src/include/time.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/include/time.h b/src/include/time.h index e17db219..53c0dbd2 100644 --- a/src/include/time.h +++ b/src/include/time.h @@ -1,4 +1,4 @@ -/* $OpenBSD: time.h,v 1.20 2011/07/03 18:51:01 jsg Exp $ */ +/* $OpenBSD: time.h,v 1.21 2012/05/07 22:34:00 kettenis Exp $ */ /* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */ /* @@ -87,6 +87,20 @@ struct timespec { }; #endif +#if __POSIX_VISIBLE >= 200112 +#include + +#ifndef _CLOCKID_T_DEFINED_ +#define _CLOCKID_T_DEFINED_ +typedef __clockid_t clockid_t; +#endif + +#ifndef _TIMER_T_DEFINED_ +#define _TIMER_T_DEFINED_ +typedef __timer_t timer_t; +#endif +#endif + struct tm { int tm_sec; /* seconds after the minute [0-60] */ int tm_min; /* minutes after the hour [0-59] */ @@ -102,7 +116,6 @@ struct tm { }; __BEGIN_DECLS -struct timespec; char *asctime(const struct tm *); clock_t clock(void); char *ctime(const time_t *); @@ -127,6 +140,12 @@ extern char *tzname[2]; void tzset(void); #endif +#if __POSIX_VISIBLE >= 200112 +int clock_getres(clockid_t, struct timespec *); +int clock_gettime(clockid_t, struct timespec *); +int clock_settime(clockid_t, const struct timespec *); +#endif + #if __BSD_VISIBLE char *timezone(int, int); void tzsetwall(void);