File: Time.hpp

package info (click to toggle)
soapysdr 0.8.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 948 kB
  • sloc: cpp: 5,378; ansic: 471; python: 311; sh: 21; makefile: 18
file content (44 lines) | stat: -rw-r--r-- 1,108 bytes parent folder | download | duplicates (6)
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
34
35
36
37
38
39
40
41
42
43
44
///
/// \file SoapySDR/Time.hpp
///
/// Utility functions to convert time and ticks.
///
/// \copyright
/// Copyright (c) 2015-2015 Josh Blum
/// SPDX-License-Identifier: BSL-1.0
///

#pragma once
#include <SoapySDR/Config.hpp>
#include <SoapySDR/Time.h>

namespace SoapySDR
{

/*!
 * Convert a tick count into a time in nanoseconds using the tick rate.
 * \param ticks a integer tick count
 * \param rate the ticks per second
 * \return the time in nanoseconds
 */
static inline long long ticksToTimeNs(const long long ticks, const double rate);

/*!
 * Convert a time in nanoseconds into a tick count using the tick rate.
 * \param timeNs time in nanoseconds
 * \param rate the ticks per second
 * \return the integer tick count
 */
static inline long long timeNsToTicks(const long long timeNs, const double rate);

}

static inline long long SoapySDR::ticksToTimeNs(const long long ticks, const double rate)
{
    return SoapySDR_ticksToTimeNs(ticks, rate);
}

static inline long long SoapySDR::timeNsToTicks(const long long timeNs, const double rate)
{
    return SoapySDR_timeNsToTicks(timeNs, rate);
}