Browse Source

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@
OPENBSD_5_2
kettenis 12 years ago
parent
commit
b885cf85d0
1 changed files with 11 additions and 5 deletions
  1. +11
    -5
      src/include/time.h

+ 11
- 5
src/include/time.h View File

@ -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 $ */ /* $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(). */ #define CLOCKS_PER_SEC 100 /* frequency of ticks reported by clock(). */
#if __POSIX_VISIBLE >= 199309
#ifndef _TIMESPEC_DECLARED #ifndef _TIMESPEC_DECLARED
#define _TIMESPEC_DECLARED #define _TIMESPEC_DECLARED
struct timespec { struct timespec {
@ -87,7 +88,6 @@ struct timespec {
}; };
#endif #endif
#if __POSIX_VISIBLE >= 200112
#include <sys/_time.h> #include <sys/_time.h>
#ifndef _CLOCKID_T_DEFINED_ #ifndef _CLOCKID_T_DEFINED_
@ -125,25 +125,31 @@ struct tm *localtime(const time_t *);
time_t mktime(struct tm *); time_t mktime(struct tm *);
size_t strftime(char *, size_t, const char *, const struct tm *) size_t strftime(char *, size_t, const char *, const struct tm *)
__attribute__ ((__bounded__(__string__,1,2))); __attribute__ ((__bounded__(__string__,1,2)));
char *strptime(const char *, const char *, struct tm *);
time_t time(time_t *); 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 *) char *asctime_r(const struct tm *, char *)
__attribute__ ((__bounded__(__minbytes__,2,26))); __attribute__ ((__bounded__(__minbytes__,2,26)));
char *ctime_r(const time_t *, char *) char *ctime_r(const time_t *, char *)
__attribute__ ((__bounded__(__minbytes__,2,26))); __attribute__ ((__bounded__(__minbytes__,2,26)));
struct tm *gmtime_r(const time_t *, struct tm *); struct tm *gmtime_r(const time_t *, struct tm *);
struct tm *localtime_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 #if __POSIX_VISIBLE
extern char *tzname[2]; extern char *tzname[2];
void tzset(void); void tzset(void);
#endif #endif
#if __POSIX_VISIBLE >= 200112
#if __POSIX_VISIBLE >= 199309
int clock_getres(clockid_t, struct timespec *); int clock_getres(clockid_t, struct timespec *);
int clock_gettime(clockid_t, struct timespec *); int clock_gettime(clockid_t, struct timespec *);
int clock_settime(clockid_t, const struct timespec *); int clock_settime(clockid_t, const struct timespec *);
int nanosleep(const struct timespec *, struct timespec *);
#endif #endif
#if __BSD_VISIBLE #if __BSD_VISIBLE


Loading…
Cancel
Save