GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
gnss_sdr_time_counter.h
Go to the documentation of this file.
1 /*!
2  * \file gnss_sdr_time_counter.h
3  * \brief Simple block to report the current receiver time based on the output of the tracking or telemetry blocks
4  * \author Antonio Ramos 2018. antonio.ramosdet(at)gmail.com
5  *
6  *
7  * -----------------------------------------------------------------------------
8  *
9  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
10  *
11  * GNSS-SDR is a software defined Global Navigation
12  * Satellite Systems receiver
13  *
14  * This file is part of GNSS-SDR.
15  *
16  * SPDX-License-Identifier: GPL-3.0-or-later
17  *
18  * -----------------------------------------------------------------------------
19  */
20 
21 #ifndef GNSS_SDR_GNSS_SDR_TIME_COUNTER_H
22 #define GNSS_SDR_GNSS_SDR_TIME_COUNTER_H
23 
24 #include <gnuradio/block.h>
25 #include <gnuradio/types.h> // for gr_vector_const_void_star
26 #include <cstdint>
27 #include <memory>
28 
30 
31 using gnss_sdr_time_counter_sptr = std::shared_ptr<gnss_sdr_time_counter>;
32 
33 gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter();
34 
35 class gnss_sdr_time_counter : public gr::block
36 {
37 public:
38  ~gnss_sdr_time_counter() = default;
39  int general_work(int noutput_items __attribute__((unused)),
40  gr_vector_int &ninput_items __attribute__((unused)),
41  gr_vector_const_void_star &input_items __attribute__((unused)),
42  gr_vector_void_star &output_items);
43 
44 private:
46  friend gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter();
47 
48  int64_t current_T_rx_ms; // Receiver time in ms since the beginning of the run
49  int32_t report_interval_ms;
50  uint32_t current_s; // Receiver time in seconds, modulo 60
51  uint32_t current_m; // Receiver time in minutes, modulo 60
52  uint32_t current_h; // Receiver time in hours, modulo 24
53  uint32_t current_days; // Receiver time in days since the beginning of the run
54  bool flag_m; // True if the receiver has been running for at least 1 minute
55  bool flag_h; // True if the receiver has been running for at least 1 hour
56  bool flag_days; // True if the receiver has been running for at least 1 day
57 };
58 
59 #endif // GNSS_SDR_GNSS_SDR_SAMPLE_COUNTER_H