summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2012-05-10 19:13:13 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2012-05-10 19:13:13 +0000
commitc9b86379c3789402bfab8ac8ca1b3c75f062fd7f (patch)
treef08b7bc3058fe43ed038b309b6e5ea19b996c232 /include
parentfe66082bf59c06d47c3d559059dbc8fb82bf1c93 (diff)
Recongnize that:
* strptime(3) was introduced in XPG 4.0 * clock_gettime(3) and friends were introduced in 1003.1b-1993 * asctime_r(3) and friends were introduced in 1003.1c-1995 and conditionally provide prototypes and associated types accordingly. This makes our <time.h> standards compliant except for some functions that are still missing. ok guenther@
Diffstat (limited to 'include')
-rw-r--r--include/time.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/include/time.h b/include/time.h
index 53c0dbd2c59..a53da7996b3 100644
--- a/include/time.h
+++ b/include/time.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: time.h,v 1.21 2012/05/07 22:34:00 kettenis Exp $ */
+/* $OpenBSD: time.h,v 1.22 2012/05/10 19:13:12 kettenis Exp $ */
/* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */
/*
@@ -79,6 +79,7 @@ typedef __size_t size_t;
#define CLOCKS_PER_SEC 100 /* frequency of ticks reported by clock(). */
+#if __POSIX_VISIBLE >= 199309
#ifndef _TIMESPEC_DECLARED
#define _TIMESPEC_DECLARED
struct timespec {
@@ -87,7 +88,6 @@ struct timespec {
};
#endif
-#if __POSIX_VISIBLE >= 200112
#include <sys/_time.h>
#ifndef _CLOCKID_T_DEFINED_
@@ -125,25 +125,31 @@ struct tm *localtime(const time_t *);
time_t mktime(struct tm *);
size_t strftime(char *, size_t, const char *, const struct tm *)
__attribute__ ((__bounded__(__string__,1,2)));
-char *strptime(const char *, const char *, struct tm *);
time_t time(time_t *);
+
+#if __XPG_VISIBLE >= 400
+char *strptime(const char *, const char *, struct tm *);
+#endif
+
+#if __POSIX_VISIBLE >= 199506
char *asctime_r(const struct tm *, char *)
__attribute__ ((__bounded__(__minbytes__,2,26)));
char *ctime_r(const time_t *, char *)
__attribute__ ((__bounded__(__minbytes__,2,26)));
struct tm *gmtime_r(const time_t *, struct tm *);
struct tm *localtime_r(const time_t *, struct tm *);
-int nanosleep(const struct timespec *, struct timespec *);
+#endif
#if __POSIX_VISIBLE
extern char *tzname[2];
void tzset(void);
#endif
-#if __POSIX_VISIBLE >= 200112
+#if __POSIX_VISIBLE >= 199309
int clock_getres(clockid_t, struct timespec *);
int clock_gettime(clockid_t, struct timespec *);
int clock_settime(clockid_t, const struct timespec *);
+int nanosleep(const struct timespec *, struct timespec *);
#endif
#if __BSD_VISIBLE