source: rtems/cpukit/score/src/timespecfromticks.c @ 632e4306

4.104.115
Last change on this file since 632e4306 was 3d66dfc1, checked in by Joel Sherrill <joel.sherrill@…>, on 12/16/08 at 17:36:01

2008-12-16 Joel Sherrill <joel.sherrill@…>

  • libcsupport/src/times.c, posix/src/adjtime.c, posix/src/clockgetres.c, posix/src/sysconf.c, rtems/src/clockgettickspersecond.c, rtems/src/clockgettod.c, rtems/src/clockset.c, rtems/src/clocktodvalidate.c, score/src/timespecfromticks.c, score/src/timespectoticks.c, score/src/ts64toticks.c: More case converted to use configuration table entry not _TOD_Microseconds_per_tick.
  • Property mode set to 100644
File size: 784 bytes
Line 
1/*
2 *  COPYRIGHT (c) 1989-2007.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <time.h>
17
18#include <rtems/system.h>
19#include <rtems/config.h>
20#include <rtems/score/timespec.h>
21#include <rtems/score/tod.h>
22
23void _Timespec_From_ticks(
24  uint32_t         ticks,
25  struct timespec *time
26)
27{
28  uint32_t    usecs;
29
30  usecs = ticks * rtems_configuration_get_microseconds_per_tick();
31
32  time->tv_sec  = usecs / TOD_MICROSECONDS_PER_SECOND;
33  time->tv_nsec = (usecs % TOD_MICROSECONDS_PER_SECOND) *
34                    TOD_NANOSECONDS_PER_MICROSECOND;
35}
Note: See TracBrowser for help on using the repository browser.