blob: b26c21b1966117d33ac8cdbf9045d89387c8d909 [file] [log] [blame]
Piotr Krysik34ce7a02017-10-31 11:30:59 +01001/* -*- c++ -*- */
2/* @file
3 * @author Piotr Krysik <ptrkrysik@gmail.com>
Piotr Krysik6e41d062017-11-03 09:56:49 +01004 * @author Vadim Yanitskiy <axilirator@gmail.com>
Piotr Krysik34ce7a02017-10-31 11:30:59 +01005 * @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
24
25#ifndef INCLUDED_GRGSM_FN_TIME_H
26#define INCLUDED_GRGSM_FN_TIME_H
27
Piotr Krysik6e41d062017-11-03 09:56:49 +010028#include <grgsm/api.h>
Piotr Krysik34ce7a02017-10-31 11:30:59 +010029#include <stdint.h>
Piotr Krysik6e41d062017-11-03 09:56:49 +010030#include <utility>
Piotr Krysik34ce7a02017-10-31 11:30:59 +010031
32namespace gr {
33 namespace gsm {
34
35 /**
36 * Computes difference between reference frame number
37 * and a second frame number.
38 * @param fn_ref reference frame number modulo GSM_HYPER_FRAME
39 * @param fn second frame number modulo GSM_HYPER_FRAME
40 * @param time_ref precise timestamp of the first sample in the fn_ref
41 * @param time_hint coarse time for fn that is used as a hint to avoid
42 * ambiguities caused by modulo operation applied to
43 * frame numbers
44 * @return difference between fn_ref and fn
45 */
Piotr Krysik6e41d062017-11-03 09:56:49 +010046 typedef std::pair<unsigned long long, double> time_format;
47
48 GRGSM_API time_format fn_time_delta_cpp(uint32_t fn_ref, time_format time_ref, uint32_t fn_x,
49 time_format time_hint, uint32_t ts_num, uint32_t ts_ref);
Piotr Krysik34ce7a02017-10-31 11:30:59 +010050
Piotr Krysik6e41d062017-11-03 09:56:49 +010051 } // namespace gsm
Piotr Krysik34ce7a02017-10-31 11:30:59 +010052} // namespace gr
53
54#endif /* INCLUDED_GRGSM_FN_TIME_H */
55