source: rtems/cpukit/libcsupport/src/__gettod.c @ 23a0105a

4.104.114.84.95
Last change on this file since 23a0105a was 812da54, checked in by Joel Sherrill <joel.sherrill@…>, on 04/02/07 at 18:23:59

2007-04-02 Joel Sherrill <joel@…>

  • itron/src/itrontime.c, libcsupport/src/gettod.c, posix/include/rtems/posix/time.h, posix/include/rtems/posix/timer.h, posix/src/clockgettime.c, posix/src/clocksettime.c, posix/src/nanosleep.c, posix/src/posixtimespecsubtract.c, posix/src/posixtimespectointerval.c, posix/src/ptimer1.c, posix/src/sleep.c, rtems/Makefile.am, rtems/include/rtems/rtems/clock.h, rtems/include/rtems/rtems/timer.h, rtems/include/rtems/rtems/types.h, rtems/src/clockget.c, rtems/src/clockset.c, rtems/src/clocktodtoseconds.c, rtems/src/clocktodvalidate.c, rtems/src/taskwakewhen.c, score/Makefile.am, score/include/rtems/score/tod.h, score/inline/rtems/score/tod.inl, score/src/coretod.c, score/src/coretodset.c: Convert from Classic API style TOD_Control as fundamental time structure to POSIX struct timespec. Add clock_get_uptime().
  • rtems/src/clockgetuptime.c, score/src/coretodget.c, score/src/coretodgetuptime.c: New files.
  • score/src/coretodtickle.c, score/src/coretodtoseconds.c, score/src/coretodvalidate.c: Removed.
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  gettimeofday() - SVR4 and BSD4.3 extension required by Newlib
3 *
4 *  COPYRIGHT (c) 1989-2007.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
19
20#include <rtems.h>
21
22#if !defined(RTEMS_UNIX)
23#ifdef RTEMS_NEWLIB
24#include <sys/reent.h>
25#endif
26
27#include <sys/time.h>
28#include <time.h>
29
30#include <errno.h>
31
32/*
33 *  NOTE:  The solaris gettimeofday does not have a second parameter.
34 */
35
36int gettimeofday(
37  struct timeval  *tp,
38  struct timezone *tzp
39)
40{
41  if ( !tp ) {
42    errno = EFAULT;
43    return -1;
44  }
45
46  /*
47   *  POSIX does not seem to allow for not having a TOD so we just
48   *  grab the time of day.
49   */
50
51  _TOD_Get_timeval( tp );
52
53  /*
54   *  Timezone information ignored by the OS proper.   Per email
55   *  with Eric Norum, this is how GNU/Linux, Solaris, and MacOS X
56   *  do it.  This puts us in good company.
57   */
58
59  return 0;
60}
61
62#if defined(RTEMS_NEWLIB)
63
64/*
65 *  "Reentrant" version
66 */
67
68int _gettimeofday_r(
69  struct _reent   *ignored_reentrancy_stuff,
70  struct timeval  *tp,
71  struct timezone *tzp
72)
73{
74  return gettimeofday( tp, tzp );
75}
76
77/*
78 *  "System call" version
79 */
80
81int _gettimeofday(
82  struct timeval  *tp,
83  struct timezone *tzp
84)
85{
86  return gettimeofday( tp, tzp );
87}
88
89#endif /* defined(RTEMS_NEWLIB) */
90
91#endif
Note: See TracBrowser for help on using the repository browser.