source: rtems/cpukit/libcsupport/src/__gettod.c @ 1f67156

4.115
Last change on this file since 1f67156 was 1f67156, checked in by Sebastian Huber <sebastian.huber@…>, on 03/09/15 at 12:18:36

libcsupport: Delete superfluous _gettimeofday()

  • 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.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#if defined(RTEMS_NEWLIB)
22/*
23 *  Needed to get the prototype for the newlib helper method
24 */
25#define _COMPILING_NEWLIB
26
27#include <sys/time.h>
28#include <reent.h>
29#include <errno.h>
30#include <rtems/score/todimpl.h>
31#include <rtems/seterr.h>
32
33#if defined(RTEMS_NEWLIB) && !defined(HAVE_GETTIMEOFDAY)
34
35/**
36 *  SVR4 and BSD4.3 extension required by Newlib
37 *
38 *  @note The solaris gettimeofday does not have a second parameter.
39 */
40int gettimeofday(
41  struct timeval *__restrict tp,
42  void *__restrict __tz __attribute__((unused))
43)
44{
45  /* struct timezone* tzp = (struct timezone*) __tz; */
46  if ( !tp )
47    rtems_set_errno_and_return_minus_one( EFAULT );
48
49  /*
50   *  POSIX does not seem to allow for not having a TOD so we just
51   *  grab the time of day.
52   */
53  _TOD_Get_timeval( tp );
54
55  /*
56   *  Timezone information ignored by the OS proper.   Per email
57   *  with Eric Norum, this is how GNU/Linux, Solaris, and MacOS X
58   *  do it.  This puts us in good company.
59   */
60
61  return 0;
62}
63#endif
64
65#if defined(RTEMS_NEWLIB) && !defined(HAVE__GETTIMEOFDAY_R)
66
67#include <sys/reent.h>
68
69/**
70 *  "Reentrant" version
71 */
72int _gettimeofday_r(
73  struct _reent   *ignored_reentrancy_stuff __attribute__((unused)),
74  struct timeval  *tp,
75  void           *__tz
76)
77{
78  struct timezone *tzp = __tz;
79  return gettimeofday( tp, tzp );
80}
81#endif
82
83#endif /* defined(RTEMS_NEWLIB) */
Note: See TracBrowser for help on using the repository browser.