aboutsummaryrefslogtreecommitdiffstats
path: root/include/time.h
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1997-05-13 09:33:24 +0000
committerPeter Wemm <peter@FreeBSD.org>1997-05-13 09:33:24 +0000
commitf154fbdaa1e10a9946d70eba778fce3ac9d0beb7 (patch)
tree82eaf62af6643fa50e9e9d798802361eb55f6721 /include/time.h
parenta85412b4a59665710c37eca6ba110e3a968ed5db (diff)
downloadsrc-f154fbdaa1e10a9946d70eba778fce3ac9d0beb7.tar.gz
src-f154fbdaa1e10a9946d70eba778fce3ac9d0beb7.zip
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).
Notes
Notes: svn path=/head/; revision=25773
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 6ffb3b0af442..dfc4e5976e86 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