-#include <time.h>
\ No newline at end of file
+#ifndef _SYS_TIME_H
+#define _SYS_TIME_H
+
+#include <time.h>
+
+#ifdef _BSD_SOURCE
+
+typedef unsigned long suseconds_t;
+
+struct timeval {
+ time_t tv_sec;
+ suseconds_t tv_usec;
+};
+
+extern int gettimeofday(struct timeval *tv, struct timezone *tz);
+extern int settimeofday(struct timeval *tv, const struct timezone *tz);
+
+/* These are courtesy of Linux. Complete with the usual bugs. The only
+ change here is to use L for the long types. */
+# define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
+# define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
+# define timercmp(a, b, CMP) \
+ (((a)->tv_sec == (b)->tv_sec) ? \
+ ((a)->tv_usec CMP (b)->tv_usec) : \
+ ((a)->tv_sec CMP (b)->tv_sec))
+# define timeradd(a, b, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
+ if ((result)->tv_usec >= 1000000L) \
+ { \
+ ++(result)->tv_sec; \
+ (result)->tv_usec -= 1000000L; \
+ } \
+ } while (0)
+# define timersub(a, b, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
+ if ((result)->tv_usec < 0) { \
+ --(result)->tv_sec; \
+ (result)->tv_usec += 1000000L; \
+ } \
+ } while (0)
+
+#endif /* Berkleyisms */
+
+#endif
int tz_dsttime; /* type of dst correction */
};
+struct timespec {
+ time_t tv_sec;
+ long tv_nsec;
+};
+
#define __isleap(year) \
((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
extern struct tm *localtime __P ((time_t * __tp));
extern unsigned long convtime __P ((time_t *time_field));
+typedef int clockid_t;
+
#define CLOCKS_PER_SEC 100 /* FIXME: sysconf */
+
+#define CLOCK_REALTIME 0
+#define CLOCK_MONOTONIC 1
+
+extern int clock_getres(clockid_t clk_id, struct timespec *res);
+extern int clock_gettime(clockid_t clk_id, struct timespec *tp);
+extern int clock_nanosleep(clockid_t clk_id, int flags,
+ const struct timespec *request, struct timespec *remain);
+extern int clock_settime(clockid_t clk_id, const struct timespec *tp);
+
+#define TIMER_ABSTIME 1
+
+extern int nanosleep(const struct timespec *request, struct timespec *remain);
+
#endif
#define _POSIX_CHOWN_RESTRICTED _pathconf(_PC_CHOWN_RESTRICTED)
#define _POSIX_NO_TRUNC _pathconf(_PC_NO_TRUNC)
+/* POSIX: show that the clock_ API is present */
+#define _POSIX_TIMERS
+#define _POSIX_MONTONIC_CLOCK
+
extern int gethostname(char *name, size_t len);
extern int sethostname(const char *name, size_t len);