mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.9 KiB
C
65 lines
1.9 KiB
C
4 years ago
|
/**
|
||
10 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
10 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||
10 years ago
|
*
|
||
4 years ago
|
* By using this file, you agree to the terms and conditions set
|
||
|
* forth in the LICENSE file which can be found at the top level of
|
||
|
* the distribution.
|
||
10 years ago
|
*
|
||
|
*/
|
||
|
|
||
10 years ago
|
/**********************************************************************************************
|
||
|
* File: timestamp.h
|
||
|
*
|
||
|
* Description: A simple timestamp struct with separate variables for full and frac seconds.
|
||
|
* Separate variables are used to avoid loss of precision in our frac seconds.
|
||
|
* Only positive timestamps are supported.
|
||
|
*
|
||
|
* Reference:
|
||
|
*********************************************************************************************/
|
||
10 years ago
|
|
||
4 years ago
|
#ifndef SRSRAN_TIMESTAMP_H
|
||
|
#define SRSRAN_TIMESTAMP_H
|
||
10 years ago
|
|
||
4 years ago
|
#include "srsran/config.h"
|
||
6 years ago
|
#include <stdbool.h>
|
||
|
#include <stdint.h>
|
||
|
#include <time.h>
|
||
10 years ago
|
|
||
4 years ago
|
typedef struct SRSRAN_API {
|
||
10 years ago
|
time_t full_secs;
|
||
|
double frac_secs;
|
||
4 years ago
|
} srsran_timestamp_t;
|
||
10 years ago
|
|
||
6 years ago
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
4 years ago
|
SRSRAN_API int srsran_timestamp_init(srsran_timestamp_t* t, time_t full_secs, double frac_secs);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_timestamp_init_uint64(srsran_timestamp_t* ts_time, uint64_t ts_count, double base_srate);
|
||
6 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_timestamp_copy(srsran_timestamp_t* dest, srsran_timestamp_t* src);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_timestamp_compare(const srsran_timestamp_t* a, const srsran_timestamp_t* b);
|
||
6 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_timestamp_add(srsran_timestamp_t* t, time_t full_secs, double frac_secs);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_timestamp_sub(srsran_timestamp_t* t, time_t full_secs, double frac_secs);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API double srsran_timestamp_real(const srsran_timestamp_t* t);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API bool srsran_timestamp_iszero(const srsran_timestamp_t* t);
|
||
6 years ago
|
|
||
4 years ago
|
SRSRAN_API uint32_t srsran_timestamp_uint32(srsran_timestamp_t* t);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API uint64_t srsran_timestamp_uint64(const srsran_timestamp_t* t, double srate);
|
||
6 years ago
|
|
||
6 years ago
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
4 years ago
|
#endif // SRSRAN_TIMESTAMP_H
|