Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
utctime.hh
Go to the documentation of this file.
1#ifndef __UTCTIME_HH
2#define __UTCTIME_HH
3
4#include <ostream>
5#include <stdint.h>
6#include <arpa/inet.h>
7
8/**
9 * \author cpellegrino
10 */
11
12struct UTCTime
13{
14 uint32_t Sec;
15 uint32_t Tics;
16
17 uint32_t sec() const
18 {
19 return ntohl(Sec);
20 }
21
22 uint32_t tics() const
23 {
24 return ntohl(Tics);
25 }
26
27 uint64_t inMilliSeconds() const
28 {
29 return uint64_t(sec()) * 1000 + uint64_t(tics()) / 62500;
30 }
31
32};
33
34inline std::ostream& operator <<(std::ostream& stream, const UTCTime& t)
35{
36 return stream << "Seconds: " << t.sec() << '\n'
37 << "Tics: " << t.tics();
38}
39
40#endif
uint32_t Sec
Definition utctime.hh:14
uint32_t sec() const
Definition utctime.hh:17
uint32_t Tics
Definition utctime.hh:15
uint32_t tics() const
Definition utctime.hh:22
uint64_t inMilliSeconds() const
Definition utctime.hh:27
std::ostream & operator<<(std::ostream &stream, const UTCTime &t)
Definition utctime.hh:34