summaryrefslogtreecommitdiffstats
path: root/include/time.h
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-05-13 09:33:24 +0000
committerpeter <peter@FreeBSD.org>1997-05-13 09:33:24 +0000
commitbbffd7053b45f95b65ff661f1d6ece91289c4dc4 (patch)
tree8bf22a3a31b53a70fa1d3c798569e1e13b83db2c /include/time.h
parentf3628422839fdc4de93138567ba259a01e44e9dd (diff)
downloadFreeBSD-src-bbffd7053b45f95b65ff661f1d6ece91289c4dc4.zip
FreeBSD-src-bbffd7053b45f95b65ff661f1d6ece91289c4dc4.tar.gz
struct timespec needs to be useable with just <time.h>, but needs to not
conflict with the kernel visible one. Make the new stuff not visible if _ANSI_SOURCE or _POSIX_SOURCE is defined (!) because the new things are not part of the base 1003.1-1990 standard (or ansi).
Diffstat (limited to 'include/time.h')
-rw-r--r--include/time.h34
1 files changed, 27 insertions, 7 deletions
diff --git a/include/time.h b/include/time.h
index 6ffb3b0..dfc4e59 100644
--- a/include/time.h
+++ b/include/time.h
@@ -68,16 +68,34 @@ typedef _BSD_TIME_T_ time_t;
#undef _BSD_TIME_T_
#endif
+#ifdef _BSD_SIZE_T_
+typedef _BSD_SIZE_T_ size_t;
+#undef _BSD_SIZE_T_
+#endif
+
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+/*
+ * New in POSIX 1003.1b-1993.
+ */
#ifdef _BSD_CLOCKID_T_
typedef _BSD_CLOCKID_T_ clockid_t;
#undef _BSD_CLOCKID_T_
#endif
-#ifdef _BSD_SIZE_T_
-typedef _BSD_SIZE_T_ size_t;
-#undef _BSD_SIZE_T_
+#ifdef _BSD_TIMER_T_
+typedef _BSD_TIMER_T_ timer_t;
+#undef _BSD_TIMER_T_
#endif
+#ifndef _TIMESPEC_DECLARED
+#define _TIMESPEC_DECLARED
+struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* and nanoseconds */
+};
+#endif
+#endif /* Neither ANSI nor POSIX */
+
struct tm {
int tm_sec; /* seconds after the minute [0-60] */
int tm_min; /* minutes after the hour [0-59] */
@@ -97,15 +115,11 @@ struct tm {
__BEGIN_DECLS
char *asctime __P((const struct tm *));
clock_t clock __P((void));
-int clock_getres __P((clockid_t, struct timespec *));
-int clock_gettime __P((clockid_t, struct timespec *));
-int clock_settime __P((clockid_t, const struct timespec *));
char *ctime __P((const time_t *));
double difftime __P((time_t, time_t));
struct tm *gmtime __P((const time_t *));
struct tm *localtime __P((const time_t *));
time_t mktime __P((struct tm *));
-int nanosleep __P((const struct timespec *, struct timespec *));
size_t strftime __P((char *, size_t, const char *, const struct tm *));
time_t time __P((time_t *));
@@ -125,6 +139,12 @@ char *timezone __P((int, int));
void tzsetwall __P((void));
time_t timelocal __P((struct tm * const));
time_t timegm __P((struct tm * const));
+
+/* Introduced in POSIX 1003.1b-1993, not part of 1003.1-1990. */
+int clock_getres __P((clockid_t, struct timespec *));
+int clock_gettime __P((clockid_t, struct timespec *));
+int clock_settime __P((clockid_t, const struct timespec *));
+int nanosleep __P((const struct timespec *, struct timespec *));
#endif /* neither ANSI nor POSIX */
__END_DECLS
OpenPOWER on IntegriCloud