source: rtems/cpukit/posix/src/time.c @ f4719d5a

4.104.114.84.95
Last change on this file since f4719d5a was f4719d5a, checked in by Joel Sherrill <joel.sherrill@…>, on 05/22/96 at 22:32:39

These files have been modified in the initial pass at getting the portion
of the POSIX API necessary to support the GNAT runtime to initially compile.
We now have verified that the specifications for the necessary routines
are correct per the POSIX standards we have.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/* time.c
2 *
3 *  $Id$
4 */
5
6#include <time.h>
7
8#include <rtems/system.h>
9#include <rtems/score/tod.h>
10
11/*
12 *  Seconds from January 1, 1970 to January 1, 1988.  Used to account for
13 *  differences between POSIX API and RTEMS core.
14 */
15
16#define POSIX_TIME_SECONDS_1970_THROUGH_1988 \
17  (((1987 - 1970 + 1)  * TOD_SECONDS_PER_NON_LEAP_YEAR) + \
18  (4 * TOD_SECONDS_PER_DAY))
19
20/*
21 *  4.5.1 Get System Time, P1003.1b-1993, p. 91
22 */
23
24time_t time(
25  time_t   *tloc
26)
27{
28  time_t  seconds_since_epoch;
29
30  if ( !_TOD_Is_set() ) {
31    /* XXX set errno */
32    return -1;
33  }
34
35  /*
36   *  Internally the RTEMS epoch is 1988.  This must be taken into account.
37   */
38
39  seconds_since_epoch = _TOD_Seconds_since_epoch;
40     
41  seconds_since_epoch += POSIX_TIME_SECONDS_1970_THROUGH_1988;
42
43  if ( tloc )
44    *tloc = seconds_since_epoch;
45
46  return seconds_since_epoch;
47}
48
49#ifdef NOT_IMPLEMENTED_YET
50/*
51 *  14.2.1 Clocks, P1003.1b-1993, p. 263
52 */
53
54int clock_settime(
55  clockid_t              clock_id,
56  const struct timespec *tp
57)
58{
59  return POSIX_NOT_IMPLEMENTED();
60}
61
62/*
63 *  14.2.1 Clocks, P1003.1b-1993, p. 263
64 */
65
66int clock_gettime(
67  clockid_t        clock_id,
68  struct timespec *tp
69)
70{
71  return POSIX_NOT_IMPLEMENTED();
72}
73
74/*
75 *  14.2.1 Clocks, P1003.1b-1993, p. 263
76 */
77
78int clock_getres(
79  clockid_t        clock_id,
80  struct timespec *res
81)
82{
83  return POSIX_NOT_IMPLEMENTED();
84}
85
86/*
87 *  14.2.2 Create a Per-Process Timer, P1003.1b-1993, p. 264
88 */
89
90int timer_create(
91  clockid_t        clock_id,
92  struct sigevent *evp,
93  timer_t         *timerid
94)
95{
96  return POSIX_NOT_IMPLEMENTED();
97}
98
99/*
100 *  14.2.3 Delete a Per_process Timer, P1003.1b-1993, p. 266
101 */
102
103int timer_delete(
104  timer_t timerid
105)
106{
107  return POSIX_NOT_IMPLEMENTED();
108}
109
110/*
111 *  14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
112 */
113
114int timer_settime(
115  timer_t                  timerid,
116  int                      flags,
117  const struct itimerspec *value,
118  struct itimerspec       *ovalue
119)
120{
121  return POSIX_NOT_IMPLEMENTED();
122}
123
124/*
125 *  14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
126 */
127
128int timer_gettime(
129  timer_t            timerid,
130  struct itimerspec *value
131)
132{
133  return POSIX_NOT_IMPLEMENTED();
134}
135
136/*
137 *  14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
138 */
139
140int timer_getoverrun(
141  timer_t   timerid
142)
143{
144  return POSIX_NOT_IMPLEMENTED();
145}
146
147/*
148 *  14.2.5 High Resolution Sleep, P1003.1b-1993, p. 269
149 */
150
151int nanosleep(
152  const struct timespec  *rqtp,
153  struct timespec        *rmtp
154)
155{
156  return POSIX_NOT_IMPLEMENTED();
157}
158
159/*
160 *  20.1.3 Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55
161 */
162
163int clock_getcpuclockid(
164  pid_t      pid,
165  clockid_t *clock_id
166)
167{
168  return POSIX_NOT_IMPLEMENTED();
169}
170
171/*
172 *  20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
173 */
174
175int clock_setenable_attr(
176  clockid_t    clock_id,
177  int          attr
178)
179{
180  return POSIX_NOT_IMPLEMENTED();
181}
182
183/*
184 *  20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
185 */
186
187int clock_getenable_attr(
188  clockid_t    clock_id,
189  int         *attr
190)
191{
192  return POSIX_NOT_IMPLEMENTED();
193}
194
195#endif
Note: See TracBrowser for help on using the repository browser.