summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/clockgetuptimenanoseconds.c
blob: 8d6d90ca38c6897eb99a4198fc0e778ab00c3855 (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
/**
 * @file
 *
 * @ingroup RTEMSImplClassicClock
 *
 * @brief This source file contains the implementation of
 *   rtems_clock_get_uptime_nanoseconds().
 */

/*
 * Copyright (c) 2013 Chris Johns <chrisj@rtems.org>.  All rights reserved.
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rtems.org/license/LICENSE.
 */

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

#include <rtems/rtems/clock.h>
#include <rtems/score/timestampimpl.h>
#include <rtems/score/todimpl.h>

uint64_t rtems_clock_get_uptime_nanoseconds( void )
{
  Timestamp_Control  snapshot_as_timestamp;

  _TOD_Get_zero_based_uptime(&snapshot_as_timestamp);

  return _Timestamp_Get_as_nanoseconds(&snapshot_as_timestamp);
}