summaryrefslogtreecommitdiff
path: root/PACE/pace/time.h
blob: 4229e222e1a3298663b119dbc4305a655dda3d8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* $Id$

 * ============================================================================
 *
 * = LIBRARY
 *    pace
 *
 * = FILENAME
 *    time.h
 *
 * = AUTHOR
 *    Luther Baker
 *
 * ============================================================================ */


#ifndef PACE_TIME_H
#define PACE_TIME_H


#include "pace/defines.h"

/* Linux doesn't support this file at all.
 * Need these typedefs to just allow compilation.
 */
# if defined (linux)
typedef unsigned int clockid_t;
typedef unsigned int timerid_t;
typedef unsigned int timer_t;
struct tm { };
struct sigevent { };
struct itimerspec { };
#include "pace/unistd.h"
# else /* !linux */
#include <time.h>
#endif /* ! linux */


# if defined (PACE_HAS_CPLUSPLUS)
extern "C" {
# endif /* PACE_HAS_CPLUSPLUS */

  PACE_INLINE char * pace_asctime_r (const struct tm * tm, char * buf);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE int pace_clock_getres (clockid_t clock_id,
                                     struct timespec * res);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE int pace_clock_gettime (clockid_t clock_id,
                                      struct timespec * tp);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE int pace_clock_settime (clockid_t clock_id,
                                      const struct timespec * tp);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE char * pace_ctime_r (const time_t * clock, char * buf);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE struct tm * pace_gmtime_r (const time_t * clock,
                                         struct tm * result);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE struct tm * pace_localtime_r (const time_t * clock,
                                            struct tm * result);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE int pace_nanosleep (const struct timespec * rqtp,
                                  struct timespec * rmtp);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE int pace_time (time_t *tloc);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE int pace_timer_create (clockid_t clock_id,
                                     struct sigevent * evp,
                                     timer_t * timerid);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE int pace_timer_delete (timer_t timerid);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE int pace_timer_getoverrun (timer_t timerid);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE int pace_timer_gettime (timer_t timerid,
                                      struct itimerspec * value);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE int pace_timer_settime (timer_t timerid,
                                      int flags,
                                      const struct itimerspec * value,
                                      struct itimerspec * ovalue);
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

  PACE_INLINE void pace_tzset ();
  /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */

# if defined (PACE_HAS_CPLUSPLUS)
}
# endif /* PACE_HAS_CPLUSPLUS */

# if defined (PACE_HAS_INLINE)
# include "time.inl"
# endif /* PACE_HAS_INLINE */


#endif /* PACE_TIME_H */