summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/time.c
blob: 081f5c6d59e1dbb0560faddf326c8c4f3e301bb1 (plain) (blame)
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
/*
 *  $Id$
 */

#if HAVE_CONFIG_H
#include "config.h"
#endif

#include <assert.h>
#include <time.h>
#include <errno.h>

#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>

#include <rtems/seterr.h>
#include <rtems/posix/time.h>

/*PAGE
 *
 *  4.5.1 Get System Time, P1003.1b-1993, p. 91
 */

/* Using the implementation in newlib */
#if 0
time_t time(
  time_t   *tloc
)
{
  time_t  seconds_since_epoch;

  /*
   *  No error is the time of day is not set.   For RTEMS the system time
   *  starts out at the rtems epoch.
   */

  /*
   *  Internally the RTEMS epoch is 1988.  This must be taken into account.
   */

  seconds_since_epoch = _TOD_Seconds_since_epoch;
     
  seconds_since_epoch += POSIX_TIME_SECONDS_1970_THROUGH_1988;

  if ( tloc )
    *tloc = seconds_since_epoch;

  return seconds_since_epoch;
}
#endif