4#include <janus/janus.hpp>
39[[nodiscard]]
inline constexpr int
52template <
typename Scalar>
57 static_cast<double>(week) * 7.0 +
67template <
typename Scalar>
69 const Scalar &seconds_of_week) {
71 static_cast<double>(week) * 7.0 +
89 int week =
static_cast<int>(std::floor(days_since_epoch / 7.0));
90 double days_into_week = days_since_epoch - week * 7.0;
93 return {week, seconds_of_week};
100[[nodiscard]]
inline std::pair<int, double>
154 int day =
static_cast<int>(
constexpr double JD_GPS_EPOCH
Julian Date of GPS epoch (1980-01-06 00:00:00 UTC).
Definition TimeConstants.hpp:19
constexpr double SECONDS_PER_DAY
Seconds per day.
Definition TimeConstants.hpp:45
constexpr double TAI_GPS_OFFSET
TAI - GPS offset [s].
Definition TimeConstants.hpp:38
constexpr Scalar gps_to_tai(const Scalar &gps_jd)
Convert GPS Julian Date to TAI Julian Date.
Definition TimeScales.hpp:69
double gps_time_of_day(double seconds_of_week)
Get time of day from GPS seconds of week.
Definition GPSTime.hpp:165
constexpr Scalar utc_to_gps(const Scalar &utc_jd, int delta_at)
Convert UTC Julian Date to GPS Julian Date (templated).
Definition TimeScales.hpp:140
int leap_seconds_at_utc(double utc_jd)
Get TAI - UTC offset for a given UTC Julian Date.
Definition LeapSeconds.hpp:93
std::pair< int, double > utc_jd_to_gps_week(double utc_jd, int delta_at)
Convert UTC Julian Date to GPS week and seconds.
Definition GPSTime.hpp:84
GpsDayOfWeek gps_day_of_week(double seconds_of_week)
Get GPS day of week from seconds into the week.
Definition GPSTime.hpp:153
Scalar gps_week_to_tai_jd(int week, const Scalar &seconds_of_week)
Convert GPS week/seconds to TAI Julian Date.
Definition GPSTime.hpp:68
constexpr int GPS_WEEK_ROLLOVER
GPS week number rollover constant.
Definition GPSTime.hpp:22
constexpr int GPS_CURRENT_ROLLOVER
Current GPS week rollover count (post-April 2019).
Definition GPSTime.hpp:27
constexpr int full_gps_week(int week_mod, int rollover_count=GPS_CURRENT_ROLLOVER)
Calculate full GPS week number from a potentially rolled-over week.
Definition GPSTime.hpp:40
std::pair< int, double > utc_jd_to_gps_week_auto(double utc_jd)
Convert UTC Julian Date to GPS week and seconds (auto leap second lookup).
Definition GPSTime.hpp:101
Scalar gps_week_to_utc_jd(int week, const Scalar &seconds_of_week, int delta_at=37)
Convert GPS week/seconds to UTC Julian Date.
Definition GPSTime.hpp:53
constexpr Scalar gps_to_utc(const Scalar &gps_jd, int delta_at)
Convert GPS Julian Date to UTC Julian Date (templated).
Definition TimeScales.hpp:149
int gps_utc_offset(double utc_jd)
Get GPS - UTC offset for a given UTC Julian Date.
Definition GPSTime.hpp:119
GpsDayOfWeek
GPS day of week enumeration.
Definition GPSTime.hpp:140
@ Tuesday
Definition GPSTime.hpp:143
@ Monday
Definition GPSTime.hpp:142
@ Thursday
Definition GPSTime.hpp:145
@ Wednesday
Definition GPSTime.hpp:144
@ Saturday
Definition GPSTime.hpp:147
@ Sunday
Definition GPSTime.hpp:141
@ Friday
Definition GPSTime.hpp:146