aboutsummaryrefslogtreecommitdiffstats
path: root/include/grgsm/misc_utils/fn_time.h
blob: b26c21b1966117d33ac8cdbf9045d89387c8d909 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
/* -*- c++ -*- */
/* @file
 * @author Piotr Krysik <ptrkrysik@gmail.com>
 * @author Vadim Yanitskiy <axilirator@gmail.com>
 * @section LICENSE
 * 
 * Gr-gsm is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 * 
 * Gr-gsm is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with gr-gsm; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 * 
 */


#ifndef INCLUDED_GRGSM_FN_TIME_H
#define INCLUDED_GRGSM_FN_TIME_H

#include <grgsm/api.h>
#include <stdint.h>
#include <utility>

namespace gr {
  namespace gsm {
   
    /**
     * Computes difference between reference frame number
     * and a second frame number. 
     * @param  fn_ref    reference frame number modulo GSM_HYPER_FRAME
     * @param  fn        second frame number modulo GSM_HYPER_FRAME
     * @param  time_ref  precise timestamp of the first sample in the fn_ref
     * @param  time_hint coarse time for fn that is used as a hint to avoid
     *                   ambiguities caused by modulo operation applied to
     *                   frame numbers
     * @return           difference between fn_ref and fn
     */
     typedef std::pair<unsigned long long, double> time_format;
     
    GRGSM_API time_format fn_time_delta_cpp(uint32_t fn_ref, time_format time_ref, uint32_t fn_x,
      time_format time_hint, uint32_t ts_num, uint32_t ts_ref);

  } // namespace gsm
} // namespace gr

#endif /* INCLUDED_GRGSM_FN_TIME_H */