blob: 793944dce9fbd74dcee629a31f05e822b7fc46aa [file] [log] [blame]
Piotr Krysikdf978692017-09-27 21:58:24 +02001/* -*- c++ -*- */
2/*
3 * @file
4 * @author (C) 2017 by Piotr Krysik <ptrkrysik@gmail.com>
5 * @section LICENSE
6 *
7 * Gr-gsm is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * Gr-gsm is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with gr-gsm; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef INCLUDED_TIME_SAMPLE_REF_IMPL_H
24#define INCLUDED_TIME_SAMPLE_REF_IMPL_H
25
26#include <stdint.h>
Piotr Krysik1dd2afe2017-10-31 12:57:26 +010027#include <grgsm/misc_utils/time_spec.h>
Piotr Krysikdf978692017-09-27 21:58:24 +020028
29namespace gr {
30 namespace gsm {
31 /*
32 Class for storing time reference and for conversions time<->sample number
33 */
34 class time_sample_ref
35 {
36 private:
37 double d_samp_rate;
38 time_spec_t d_last_rx_time;
39 uint64_t d_current_start_offset;
40 public:
41 time_sample_ref(double samp_rate);
42 ~time_sample_ref();
43 void update(time_spec_t last_rx_time, uint64_t current_start_offset);
44 time_spec_t offset_to_time(uint64_t offset);
45 uint64_t time_to_offset(time_spec_t time);
46 };
47 } // namespace gsm
48} // namespace gr
49#endif// INCLUDED_TIME_SAMPLE_REF_IMPL_H