2000-02-18 03:39:52 +08:00
|
|
|
/*
|
|
|
|
* time.h
|
|
|
|
*
|
|
|
|
* Struct and function declarations for dealing with time.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _TIME_H_
|
|
|
|
#define _TIME_H_
|
|
|
|
|
|
|
|
#include "_ansi.h"
|
2016-03-15 06:23:09 +08:00
|
|
|
#include <sys/cdefs.h>
|
2002-04-18 05:23:31 +08:00
|
|
|
#include <sys/reent.h>
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2012-11-01 19:51:12 +08:00
|
|
|
#define __need_size_t
|
|
|
|
#define __need_NULL
|
|
|
|
#include <stddef.h>
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
/* Get _CLOCKS_PER_SEC_ */
|
|
|
|
#include <machine/time.h>
|
|
|
|
|
|
|
|
#ifndef _CLOCKS_PER_SEC_
|
|
|
|
#define _CLOCKS_PER_SEC_ 1000
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define CLOCKS_PER_SEC _CLOCKS_PER_SEC_
|
|
|
|
#define CLK_TCK CLOCKS_PER_SEC
|
|
|
|
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
#include <sys/types.h>
|
2015-03-11 22:38:54 +08:00
|
|
|
#include <sys/timespec.h>
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2016-07-25 17:47:36 +08:00
|
|
|
#if __POSIX_VISIBLE >= 200809
|
2017-03-22 04:21:30 +08:00
|
|
|
#include <xlocale.h>
|
2016-07-25 17:47:36 +08:00
|
|
|
#endif
|
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
_BEGIN_STD_C
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
struct tm
|
|
|
|
{
|
|
|
|
int tm_sec;
|
|
|
|
int tm_min;
|
|
|
|
int tm_hour;
|
|
|
|
int tm_mday;
|
|
|
|
int tm_mon;
|
|
|
|
int tm_year;
|
|
|
|
int tm_wday;
|
|
|
|
int tm_yday;
|
|
|
|
int tm_isdst;
|
2014-03-05 20:43:12 +08:00
|
|
|
#ifdef __TM_GMTOFF
|
|
|
|
long __TM_GMTOFF;
|
|
|
|
#endif
|
|
|
|
#ifdef __TM_ZONE
|
|
|
|
const char *__TM_ZONE;
|
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
};
|
|
|
|
|
2017-12-04 13:54:48 +08:00
|
|
|
clock_t clock (void);
|
|
|
|
double difftime (time_t _time2, time_t _time1);
|
|
|
|
time_t mktime (struct tm *_timeptr);
|
|
|
|
time_t time (time_t *_timer);
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifndef _REENT_ONLY
|
2017-12-04 13:54:48 +08:00
|
|
|
char *asctime (const struct tm *_tblock);
|
|
|
|
char *ctime (const time_t *_time);
|
|
|
|
struct tm *gmtime (const time_t *_timer);
|
|
|
|
struct tm *localtime (const time_t *_timer);
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif
|
2017-12-04 13:54:48 +08:00
|
|
|
size_t strftime (char *__restrict _s,
|
2013-11-25 21:46:23 +08:00
|
|
|
size_t _maxsize, const char *__restrict _fmt,
|
2017-12-04 13:54:48 +08:00
|
|
|
const struct tm *__restrict _t);
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2016-07-25 17:47:36 +08:00
|
|
|
#if __POSIX_VISIBLE >= 200809
|
|
|
|
extern size_t strftime_l (char *__restrict _s, size_t _maxsize,
|
|
|
|
const char *__restrict _fmt,
|
|
|
|
const struct tm *__restrict _t, locale_t _l);
|
|
|
|
#endif
|
|
|
|
|
2017-12-04 13:54:48 +08:00
|
|
|
char *asctime_r (const struct tm *__restrict,
|
|
|
|
char *__restrict);
|
|
|
|
char *ctime_r (const time_t *, char *);
|
|
|
|
struct tm *gmtime_r (const time_t *__restrict,
|
|
|
|
struct tm *__restrict);
|
|
|
|
struct tm *localtime_r (const time_t *__restrict,
|
|
|
|
struct tm *__restrict);
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
_END_STD_C
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-03-15 06:23:09 +08:00
|
|
|
#if __XSI_VISIBLE
|
2017-12-04 13:54:48 +08:00
|
|
|
char *strptime (const char *__restrict,
|
2013-11-25 21:46:23 +08:00
|
|
|
const char *__restrict,
|
2017-12-04 13:54:48 +08:00
|
|
|
struct tm *__restrict);
|
2016-03-15 06:23:09 +08:00
|
|
|
#endif
|
2016-08-23 23:42:47 +08:00
|
|
|
#if __GNU_VISIBLE
|
|
|
|
char *strptime_l (const char *__restrict, const char *__restrict,
|
|
|
|
struct tm *__restrict, locale_t);
|
|
|
|
#endif
|
|
|
|
|
2016-03-15 06:23:09 +08:00
|
|
|
#if __POSIX_VISIBLE
|
2017-12-04 13:54:48 +08:00
|
|
|
void tzset (void);
|
2016-03-15 06:23:09 +08:00
|
|
|
#endif
|
2017-12-04 13:54:48 +08:00
|
|
|
void _tzset_r (struct _reent *);
|
2002-04-18 05:23:31 +08:00
|
|
|
|
2005-02-24 03:08:58 +08:00
|
|
|
typedef struct __tzrule_struct
|
|
|
|
{
|
|
|
|
char ch;
|
|
|
|
int m;
|
|
|
|
int n;
|
|
|
|
int d;
|
|
|
|
int s;
|
|
|
|
time_t change;
|
2005-02-26 06:31:21 +08:00
|
|
|
long offset; /* Match type of _timezone. */
|
2005-02-24 03:08:58 +08:00
|
|
|
} __tzrule_type;
|
|
|
|
|
|
|
|
typedef struct __tzinfo_struct
|
|
|
|
{
|
|
|
|
int __tznorth;
|
|
|
|
int __tzyear;
|
|
|
|
__tzrule_type __tzrule[2];
|
|
|
|
} __tzinfo_type;
|
|
|
|
|
2017-12-04 13:54:48 +08:00
|
|
|
__tzinfo_type *__gettzinfo (void);
|
2005-02-24 03:08:58 +08:00
|
|
|
|
2002-06-22 02:29:23 +08:00
|
|
|
/* getdate functions */
|
|
|
|
|
|
|
|
#ifdef HAVE_GETDATE
|
2016-03-15 06:23:09 +08:00
|
|
|
#if __XSI_VISIBLE >= 4
|
2002-06-22 02:29:23 +08:00
|
|
|
#ifndef _REENT_ONLY
|
|
|
|
#define getdate_err (*__getdate_err())
|
2017-12-04 13:54:48 +08:00
|
|
|
int *__getdate_err (void);
|
2002-06-22 02:29:23 +08:00
|
|
|
|
2017-12-04 13:54:48 +08:00
|
|
|
struct tm * getdate (const char *);
|
2002-06-22 02:29:23 +08:00
|
|
|
/* getdate_err is set to one of the following values to indicate the error.
|
|
|
|
1 the DATEMSK environment variable is null or undefined,
|
|
|
|
2 the template file cannot be opened for reading,
|
|
|
|
3 failed to get file status information,
|
|
|
|
4 the template file is not a regular file,
|
|
|
|
5 an error is encountered while reading the template file,
|
|
|
|
6 memory allication failed (not enough memory available),
|
|
|
|
7 there is no line in the template that matches the input,
|
|
|
|
8 invalid input specification */
|
|
|
|
#endif /* !_REENT_ONLY */
|
2016-03-15 06:23:09 +08:00
|
|
|
#endif /* __XSI_VISIBLE >= 4 */
|
2002-06-22 02:29:23 +08:00
|
|
|
|
2016-03-15 06:23:09 +08:00
|
|
|
#if __GNU_VISIBLE
|
2002-06-22 02:29:23 +08:00
|
|
|
/* getdate_r returns the error code as above */
|
2017-12-04 13:54:48 +08:00
|
|
|
int getdate_r (const char *, struct tm *);
|
2016-03-15 06:23:09 +08:00
|
|
|
#endif /* __GNU_VISIBLE */
|
2002-06-22 02:29:23 +08:00
|
|
|
#endif /* HAVE_GETDATE */
|
|
|
|
|
2002-04-18 05:23:31 +08:00
|
|
|
/* defines for the opengroup specifications Derived from Issue 1 of the SVID. */
|
2016-03-15 06:23:09 +08:00
|
|
|
#if __SVID_VISIBLE || __XSI_VISIBLE
|
2005-02-24 03:08:58 +08:00
|
|
|
extern __IMPORT long _timezone;
|
2000-08-02 04:51:51 +08:00
|
|
|
extern __IMPORT int _daylight;
|
2016-03-15 06:23:09 +08:00
|
|
|
#endif
|
|
|
|
#if __POSIX_VISIBLE
|
2000-08-02 04:51:51 +08:00
|
|
|
extern __IMPORT char *_tzname[2];
|
2002-04-18 05:23:31 +08:00
|
|
|
|
|
|
|
/* POSIX defines the external tzname being defined in time.h */
|
2001-04-19 23:54:47 +08:00
|
|
|
#ifndef tzname
|
|
|
|
#define tzname _tzname
|
|
|
|
#endif
|
2016-03-15 06:23:09 +08:00
|
|
|
#endif /* __POSIX_VISIBLE */
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
#include <sys/features.h>
|
|
|
|
|
2005-11-18 23:45:54 +08:00
|
|
|
#ifdef __CYGWIN__
|
|
|
|
#include <cygwin/time.h>
|
|
|
|
#endif /*__CYGWIN__*/
|
|
|
|
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
#if defined(_POSIX_TIMERS)
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
/* Clocks, P1003.1b-1993, p. 263 */
|
|
|
|
|
2017-12-04 13:54:48 +08:00
|
|
|
int clock_settime (clockid_t clock_id, const struct timespec *tp);
|
|
|
|
int clock_gettime (clockid_t clock_id, struct timespec *tp);
|
|
|
|
int clock_getres (clockid_t clock_id, struct timespec *res);
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
|
|
|
|
/* Create a Per-Process Timer, P1003.1b-1993, p. 264 */
|
|
|
|
|
2017-12-04 13:54:48 +08:00
|
|
|
int timer_create (clockid_t clock_id,
|
2013-11-25 21:46:23 +08:00
|
|
|
struct sigevent *__restrict evp,
|
2017-12-04 13:54:48 +08:00
|
|
|
timer_t *__restrict timerid);
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
|
|
|
|
/* Delete a Per_process Timer, P1003.1b-1993, p. 266 */
|
|
|
|
|
2017-12-04 13:54:48 +08:00
|
|
|
int timer_delete (timer_t timerid);
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
|
|
|
|
/* Per-Process Timers, P1003.1b-1993, p. 267 */
|
|
|
|
|
2017-12-04 13:54:48 +08:00
|
|
|
int timer_settime (timer_t timerid, int flags,
|
2013-11-25 21:46:23 +08:00
|
|
|
const struct itimerspec *__restrict value,
|
2017-12-04 13:54:48 +08:00
|
|
|
struct itimerspec *__restrict ovalue);
|
|
|
|
int timer_gettime (timer_t timerid, struct itimerspec *value);
|
|
|
|
int timer_getoverrun (timer_t timerid);
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
|
|
|
|
/* High Resolution Sleep, P1003.1b-1993, p. 269 */
|
|
|
|
|
2017-12-04 13:54:48 +08:00
|
|
|
int nanosleep (const struct timespec *rqtp, struct timespec *rmtp);
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
#endif /* _POSIX_TIMERS */
|
|
|
|
|
2011-07-21 03:41:15 +08:00
|
|
|
#if defined(_POSIX_CLOCK_SELECTION)
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-12-04 13:54:48 +08:00
|
|
|
int clock_nanosleep (clockid_t clock_id, int flags,
|
|
|
|
const struct timespec *rqtp, struct timespec *rmtp);
|
2011-07-21 03:41:15 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _POSIX_CLOCK_SELECTION */
|
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
/* CPU-time Clock Attributes, P1003.4b/D8, p. 54 */
|
|
|
|
|
|
|
|
/* values for the clock enable attribute */
|
|
|
|
|
|
|
|
#define CLOCK_ENABLED 1 /* clock is enabled, i.e. counting execution time */
|
|
|
|
#define CLOCK_DISABLED 0 /* clock is disabled */
|
|
|
|
|
|
|
|
/* values for the pthread cputime_clock_allowed attribute */
|
|
|
|
|
|
|
|
#define CLOCK_ALLOWED 1 /* If a thread is created with this value a */
|
|
|
|
/* CPU-time clock attached to that thread */
|
|
|
|
/* shall be accessible. */
|
|
|
|
#define CLOCK_DISALLOWED 0 /* If a thread is created with this value, the */
|
|
|
|
/* thread shall not have a CPU-time clock */
|
|
|
|
/* accessible. */
|
|
|
|
|
|
|
|
/* Manifest Constants, P1003.1b-1993, p. 262 */
|
|
|
|
|
|
|
|
#define CLOCK_REALTIME (clockid_t)1
|
|
|
|
|
|
|
|
/* Flag indicating time is "absolute" with respect to the clock
|
|
|
|
associated with a time. */
|
|
|
|
|
2004-02-10 06:56:46 +08:00
|
|
|
#define TIMER_ABSTIME 4
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
|
|
|
|
/* Manifest Constants, P1003.4b/D8, p. 55 */
|
|
|
|
|
|
|
|
#if defined(_POSIX_CPUTIME)
|
|
|
|
|
|
|
|
/* When used in a clock or timer function call, this is interpreted as
|
|
|
|
the identifier of the CPU_time clock associated with the PROCESS
|
|
|
|
making the function call. */
|
|
|
|
|
2011-05-17 06:35:10 +08:00
|
|
|
#define CLOCK_PROCESS_CPUTIME_ID (clockid_t)2
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(_POSIX_THREAD_CPUTIME)
|
|
|
|
|
|
|
|
/* When used in a clock or timer function call, this is interpreted as
|
|
|
|
the identifier of the CPU_time clock associated with the THREAD
|
|
|
|
making the function call. */
|
|
|
|
|
2011-05-17 06:35:10 +08:00
|
|
|
#define CLOCK_THREAD_CPUTIME_ID (clockid_t)3
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2008-10-17 05:53:58 +08:00
|
|
|
#if defined(_POSIX_MONOTONIC_CLOCK)
|
|
|
|
|
|
|
|
/* The identifier for the system-wide monotonic clock, which is defined
|
|
|
|
* as a clock whose value cannot be set via clock_settime() and which
|
|
|
|
* cannot have backward clock jumps. */
|
|
|
|
|
|
|
|
#define CLOCK_MONOTONIC (clockid_t)4
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
#if defined(_POSIX_CPUTIME)
|
|
|
|
|
|
|
|
/* Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 */
|
|
|
|
|
2017-12-04 13:54:48 +08:00
|
|
|
int clock_getcpuclockid (pid_t pid, clockid_t *clock_id);
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
|
|
|
|
#endif /* _POSIX_CPUTIME */
|
|
|
|
|
|
|
|
#if defined(_POSIX_CPUTIME) || defined(_POSIX_THREAD_CPUTIME)
|
|
|
|
|
|
|
|
/* CPU-time Clock Attribute Access, P1003.4b/D8, p. 56 */
|
|
|
|
|
2017-12-04 13:54:48 +08:00
|
|
|
int clock_setenable_attr (clockid_t clock_id, int attr);
|
|
|
|
int clock_getenable_attr (clockid_t clock_id, int *attr);
|
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
2000-12-12 09:24:09 +08:00
|
|
|
|
|
|
|
#endif /* _POSIX_CPUTIME or _POSIX_THREAD_CPUTIME */
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2002-06-28 07:58:38 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif /* _TIME_H_ */
|
|
|
|
|