Added C++ version of fn_time
diff --git a/include/grgsm/misc_utils/CMakeLists.txt b/include/grgsm/misc_utils/CMakeLists.txt
index 878fcfd..5bfef6a 100644
--- a/include/grgsm/misc_utils/CMakeLists.txt
+++ b/include/grgsm/misc_utils/CMakeLists.txt
@@ -34,5 +34,6 @@
message_printer.h
tmsi_dumper.h
msg_to_tag.h
- controlled_fractional_resampler_cc.h DESTINATION include/grgsm/misc_utils
+ controlled_fractional_resampler_cc.h
+ fn_time.h DESTINATION include/grgsm/misc_utils
)
diff --git a/include/grgsm/misc_utils/fn_time.h b/include/grgsm/misc_utils/fn_time.h
new file mode 100644
index 0000000..240506a
--- /dev/null
+++ b/include/grgsm/misc_utils/fn_time.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/* @file
+ * @author Piotr Krysik <ptrkrysik@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 <stdint.h>
+#include <uhd/types/time_spec.hpp>
+
+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
+ */
+ uhd::time_spec_t fn_time_delta(uint32_t fn_ref, uhd::time_spec_t time_ref, uint32_t fn_x,
+ uhd::time_spec_t time_hint, uint32_t ts_num, uint32_t ts_ref);
+
+ } // namespace grgsm
+} // namespace gr
+
+#endif /* INCLUDED_GRGSM_FN_TIME_H */
+