Browse Source

Once more the people behind POSIX didn't think and put clock_gettime(2) and

friends in <time.h>.  The kernel needs access to the associated #defines, but
can't get them from <time.h>, so introduce a new header <sys/_time.h> and
include that from <time.h> for userland and <sys/time.h> for the kernel.
ok matthew@, guenther@, millert@
OPENBSD_5_2
kettenis 12 years ago
parent
commit
03d4ce367a
1 changed files with 21 additions and 2 deletions
  1. +21
    -2
      src/include/time.h

+ 21
- 2
src/include/time.h View File

@ -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 $ */ /* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */
/* /*
@ -87,6 +87,20 @@ struct timespec {
}; };
#endif #endif
#if __POSIX_VISIBLE >= 200112
#include <sys/_time.h>
#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 { struct tm {
int tm_sec; /* seconds after the minute [0-60] */ int tm_sec; /* seconds after the minute [0-60] */
int tm_min; /* minutes after the hour [0-59] */ int tm_min; /* minutes after the hour [0-59] */
@ -102,7 +116,6 @@ struct tm {
}; };
__BEGIN_DECLS __BEGIN_DECLS
struct timespec;
char *asctime(const struct tm *); char *asctime(const struct tm *);
clock_t clock(void); clock_t clock(void);
char *ctime(const time_t *); char *ctime(const time_t *);
@ -127,6 +140,12 @@ extern char *tzname[2];
void tzset(void); void tzset(void);
#endif #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 #if __BSD_VISIBLE
char *timezone(int, int); char *timezone(int, int);
void tzsetwall(void); void tzsetwall(void);


Loading…
Cancel
Save