source: rtems/cpukit/libcsupport/src/__gettod.c @ ae75429

4.115
Last change on this file since ae75429 was ae75429, checked in by Sebastian Huber <sebastian.huber@…>, on Aug 6, 2013 at 2:10:26 PM

PR766: Delete RTEMS_VIOLATE_KERNEL_VISIBILITY

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Get the Date and Time
5 *  @ingroup libcsupport
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#if defined(RTEMS_NEWLIB)
22#include <sys/time.h>
23#include <errno.h>
24#include <rtems/score/todimpl.h>
25#include <rtems/seterr.h>
26
27#if defined(RTEMS_NEWLIB) && !defined(HAVE_GETTIMEOFDAY)
28
29/**
30 *  SVR4 and BSD4.3 extension required by Newlib
31 *
32 *  @note The solaris gettimeofday does not have a second parameter.
33 */
34int gettimeofday(
35  struct timeval  *tp,
36  void * __tz __attribute__((unused))
37)
38{
39  /* struct timezone* tzp = (struct timezone*) __tz; */
40  if ( !tp )
41    rtems_set_errno_and_return_minus_one( EFAULT );
42
43  /*
44   *  POSIX does not seem to allow for not having a TOD so we just
45   *  grab the time of day.
46   */
47  _TOD_Get_timeval( tp );
48
49  /*
50   *  Timezone information ignored by the OS proper.   Per email
51   *  with Eric Norum, this is how GNU/Linux, Solaris, and MacOS X
52   *  do it.  This puts us in good company.
53   */
54
55  return 0;
56}
57#endif
58
59#if defined(RTEMS_NEWLIB) && !defined(HAVE__GETTIMEOFDAY_R)
60
61#include <sys/reent.h>
62
63/**
64 *  "Reentrant" version
65 */
66int _gettimeofday_r(
67  struct _reent   *ignored_reentrancy_stuff __attribute__((unused)),
68  struct timeval  *tp,
69  struct timezone *tzp
70)
71{
72  return gettimeofday( tp, tzp );
73}
74#endif
75
76#if defined(RTEMS_NEWLIB) && !defined(HAVE__GETTIMEOFDAY)
77
78/**
79 *  "System call" version
80 */
81int _gettimeofday(
82  struct timeval  *tp,
83  struct timezone *tzp
84)
85{
86  return gettimeofday( tp, tzp );
87}
88#endif
89
90#endif /* defined(RTEMS_NEWLIB) */
Note: See TracBrowser for help on using the repository browser.