HOPS
HOPS class reference
MHO_TimeStampConverter.hh
Go to the documentation of this file.
1 #ifndef MHO_TimeStampConverter_HH__
2 #define MHO_TimeStampConverter_HH__
3 
4 #include <ctime>
5 #include <string>
6 #include <time.h>
7 #include <cstdint>
8 
9 #include "MHO_Message.hh"
10 
11 namespace hops
12 {
13 
28 {
29  public:
32 
33  /*!* convert a long int epoch second count to a human readable date string in YYYY-MM-DDTHH:MM:SS.(F)Z format.
34  * The fractional_part is rounded to the nearest nano second
35  * @param epoch_sec const reference to a uint64_t to the epoch second
36  * @param fractional_part const reference to a double containing the factional second
37  * @param date reference to a std::string object where the date string is to be stored
38  * @returns a boolean indicating if the conversion was successful
39  */
40  static bool ConvertEpochSecondToTimeStamp(const uint64_t& epoch_sec, const double& fractional_part, std::string& date_string);
41 
42  /*!* Convert a date string into an epoch second and fractional second.
43  * The time stamp must be in UTC/Zulu with format: YYYY-MM-DDTHH:MM:SS.(F)Z, the
44  * number of digits in the fractional part (F) may vary.
45  * @param date const reference to the date string to be converted
46  * @param epoch_sec reference to a uint64_t where the epoch second value is to be stored
47  * @param fractional_part reference to a double where the factional second value is to be stored
48  * @returns a boolean indicating if the conversion was successful
49  */
50  static bool ConvertTimeStampToEpochSecond(const std::string& date_string, uint64_t& epoch_sec, double& fractional_part);
51 };
52 
53 } // namespace hops
54 
55 #endif
Class MHO_TimeStampConverter.
Definition: MHO_TimeStampConverter.hh:28
static bool ConvertTimeStampToEpochSecond(const std::string &date_string, uint64_t &epoch_sec, double &fractional_part)
Definition: MHO_TimeStampConverter.cc:56
~MHO_TimeStampConverter()
Definition: MHO_TimeStampConverter.hh:31
static bool ConvertEpochSecondToTimeStamp(const uint64_t &epoch_sec, const double &fractional_part, std::string &date_string)
Definition: MHO_TimeStampConverter.cc:10
MHO_TimeStampConverter()
Definition: MHO_TimeStampConverter.hh:30
Definition: MHO_ChannelLabeler.hh:17