commonlib
gps_time.h
Go to the documentation of this file.
1 
26 #pragma once
27 
28 #include "synchronization.h"
29 
30 #include "utc_time.h"
31 
32 BEGIN_NAMESPACE_SYNCHRONIZATION
33 
34 class GPSTime
35 {
36 public:
40  GPSTime();
41 
50  GPSTime(int32_t week, double seconds);
51 
56  int32_t getWeek() const;
57 
62  double getSeconds() const;
63 
70  static double RelativeSecondsBetween(const GPSTime& start, const GPSTime& end);
71 
78  static GPSTime IncrementSeconds(const GPSTime& time, double secondsIncrement);
79 
80 private:
81  int32_t week;
82  double seconds;
83 };
84 
86 {
87 public:
91  GPSTimeUTC();
92 
103  GPSTimeUTC(const GPSTime& gpsTime, double leapSeconds);
104 
113  GPSTimeUTC(int32_t week, double seconds);
114 
121  explicit GPSTimeUTC(double dateTime);
122 
127  explicit GPSTimeUTC(const UTCTime& time);
128 
133  int32_t getWeek() const;
134 
139  double getSeconds() const;
140 
145  double getDateTimeValue() const;
146 
151  int64_t getUnixTimeValue() const;
152 
159  static double RelativeSecondsBetween(const GPSTimeUTC& start, const GPSTimeUTC& end);
160 
167  static GPSTimeUTC IncrementSeconds(const GPSTimeUTC& time, double secondsIncrement);
168 
169 private:
170  int32_t week;
171  double seconds;
172 
173  void correctWeeksAndSeconds();
174 };
175 
176 END_NAMESPACE_SYNCHRONIZATION
Definition: gps_time.h:85
int32_t getWeek() const
Week since 06-Jan-1980 UTC according to UTC.
int32_t getWeek() const
Week since 06-Jan-1980 UTC.
int64_t getUnixTimeValue() const
Integer number of seconds since start of Unix time on 01-Jan-1970 UTC.
static double RelativeSecondsBetween(const GPSTime &start, const GPSTime &end)
Calculates relative seconds between two GPS times.
double getDateTimeValue() const
UTC days since 30-Dec-1899 UTC, fractional part represents ratio of day.
static GPSTime IncrementSeconds(const GPSTime &time, double secondsIncrement)
Returns a GPSTime incremented by seconds.
UTCTime converts stores human readable UTC time format offers conversions to DateTime and UnixTime fo...
static GPSTimeUTC IncrementSeconds(const GPSTimeUTC &time, double secondsIncrement)
Returns a GPSTimeUTC incremented by seconds.
GPSTimeUTC()
Constructs GPSTimeUTC with week and seconds equal to zero.
GPSTime()
Constructs GPSTime with week and seconds equal to zero.
double getSeconds() const
Seconds of GPS week.
Definition: gps_time.h:34
Definition: utc_time.h:28
static double RelativeSecondsBetween(const GPSTimeUTC &start, const GPSTimeUTC &end)
Calculates relative seconds between two GPS times UTC.
double getSeconds() const
Seconds of GPS week according to UTC.