11 #include "date/date.h"
23 #define J2000_TAI_EPOCH "2000-01-01 11:59:27.816"
24 #define ISO8601_UTC_FORMAT "%FT%TZ"
25 #define HOPS_TIMESTAMP_PREFIX "HOPS-J2000"
26 #define HOPS_TIME_DELIM "|"
27 #define HOPS_TIME_UNIT "ns"
28 #define NANOSEC_TO_SEC 1e-9
29 #define SEC_TO_NANOSEC 1000000000
30 #define JD_TO_SEC 86400.0
31 #define MINUTE_TO_SEC 60.0
32 #define HOUR_TO_SEC 3600.0
52 using rep = duration::rep;
54 using time_point = std::chrono::time_point< hops_clock, std::chrono::nanoseconds >;
71 template<
typename Duration >
72 static std::chrono::time_point< hops::utc_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
73 to_utc(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
81 template<
typename Duration >
82 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
83 from_utc(
const std::chrono::time_point< hops::utc_clock, Duration >&) NOEXCEPT;
91 template<
typename Duration >
92 static std::chrono::time_point< hops::tai_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
93 to_tai(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
101 template<
typename Duration >
102 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
103 from_tai(
const std::chrono::time_point< hops::tai_clock, Duration >&) NOEXCEPT;
111 template<
typename Duration >
112 static std::chrono::time_point< hops::gps_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
113 to_gps(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
121 template<
typename Duration >
122 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
123 from_gps(
const std::chrono::time_point< hops::gps_clock, Duration >&) NOEXCEPT;
131 template<
typename Duration >
132 static std::chrono::time_point< std::chrono::system_clock,
133 typename std::common_type< Duration, std::chrono::nanoseconds >::type >
134 to_sys(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
142 template<
typename Duration >
143 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
144 from_sys(
const std::chrono::time_point< std::chrono::system_clock, Duration >&) NOEXCEPT;
152 template<
typename Duration >
153 static std::chrono::time_point< date::local_t, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
154 to_local(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
162 template<
typename Duration >
163 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
164 from_local(
const std::chrono::time_point< date::local_t, Duration >&) NOEXCEPT;
309 using namespace std::chrono;
315 auto days_since_tai_epoch = j2000_day - tai_epoch_day;
316 auto tod = hours{11} + minutes{59} + seconds{27} + milliseconds{816};
318 duration_cast< nanoseconds >(tod)};
332 auto t_start_utc =
to_utc(t_start);
333 auto t_end_utc =
to_utc(t_end);
336 int delta = lp_info1.elapsed.count() - lp_info0.elapsed.count();
337 return std::chrono::seconds(delta);
343 static date::days day_of_year(date::sys_days sd)
345 using namespace date;
346 auto y = date::year_month_day{sd}.
year();
347 return sd - date::sys_days{y / jan / 0};
350 static date::sys_days get_year_month_day(
date::year y, date::days ord_day)
352 using namespace date;
353 return date::sys_days{y / jan / 0} + ord_day;
365 static vex_date extract_vex_date(
const std::string& timestamp);
367 static std::string vex_date_to_iso8601_string(vex_date vdate);
369 static vex_date vex_date_from_legacy(
const legacy_hops_date& legacy_date);
371 static std::string remove_trailing_zeros(std::string
value)
373 std::size_t nzeros_on_end = 0;
374 for(
auto rit =
value.rbegin(); rit !=
value.rend(); rit++)
382 std::size_t useful_length =
value.size() - nzeros_on_end;
384 for(std::size_t i = 0; i < useful_length; i++)
386 ret_val.push_back(
value[i]);
395 template<
class Duration >
using hops_time = std::chrono::time_point< hops_clock, Duration >;
403 template<
class Duration >
408 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
419 template<
class Duration >
423 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
425 return hops_time< CD >(
t.time_since_epoch() - hops_epoch_start.time_since_epoch());
434 template<
class Duration >
447 template<
class Duration >
460 template<
class Duration >
473 template<
class Duration >
486 template<
class Duration >
487 inline date::sys_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
499 template<
class Duration >
522 template<
class Duration >
523 inline date::local_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
526 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
529 std::chrono::time_point_cast< Duration >(hops_epoch_start).time_since_epoch()};
539 template<
class Duration >
543 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
547 std::chrono::time_point_cast< Duration >(hops_epoch_start).time_since_epoch()};
561 template<
class CharT,
class Traits,
class Duration >
562 std::basic_ostream< CharT, Traits >&
to_stream(std::basic_ostream< CharT, Traits >& os,
const CharT* fmt,
565 const std::string abbrev(
"HOPS");
566 CONSTDATA std::chrono::seconds offset{0};
583 template<
class Duration,
class CharT,
class Traits,
class Alloc = std::allocator< CharT > >
584 std::basic_istream< CharT, Traits >&
586 std::basic_string< CharT, Traits, Alloc >* abbrev =
nullptr, std::chrono::minutes* offset =
nullptr)
588 date::local_time< Duration > lp;
595 template<
class CharT,
class Traits,
class Duration >
596 std::basic_ostream< CharT, Traits >&
operator<<(std::basic_ostream< CharT, Traits >& os,
const hops_time< Duration >&
t)
598 const CharT fmt[] = {
'%',
'F',
'T',
'%',
'T',
'Z', CharT{}};
610 using namespace date;
611 using namespace std::chrono;
613 std::istringstream ss(timestamp);
614 std::istream tmp_stream(ss.rdbuf());
628 std::stringstream ss;
641 using namespace date;
642 using namespace std::chrono;
646 std::vector< std::string >
tokens;
651 std::string hops_prefix =
tokens[0];
652 std::string unit =
tokens[1];
653 std::string nanosecond_count =
tokens[2];
656 std::stringstream ss;
657 ss << nanosecond_count;
660 return time_point(std::chrono::nanoseconds(ns));
663 msg_error(
"utility",
"hops timestamp string not understood or supported, returning epoch start. " << eom);
664 return time_point(std::chrono::nanoseconds(0));
675 std::stringstream ss;
680 ss << tp.time_since_epoch().count();
686 vex_date vdate = vex_date_from_legacy(ldate);
687 std::string vex_as_iso8601 = vex_date_to_iso8601_string(vdate);
693 using namespace date;
694 using namespace std::chrono;
698 auto dp = date::sys_days(floor< date::days >(sys_tp));
701 date::year_month_day ymd{dp};
702 auto year = ymd.year();
705 auto ordinal_day = day_of_year(dp);
708 date::hh_mm_ss< std::chrono::nanoseconds > time{floor< std::chrono::nanoseconds >(sys_tp - dp)};
709 auto hours = time.hours();
710 auto mins = time.minutes();
711 auto secs = time.seconds();
712 auto nanos = time.subseconds();
715 ldate.
year = (int)year;
716 ldate.
day = ordinal_day.count();
717 ldate.
hour = hours.count();
718 ldate.
minute = mins.count();
728 int integer_days = (int)floating_point_days;
729 double fractional_day = floating_point_days - integer_days;
730 int integer_hours = (int)24 * fractional_day;
731 double fractional_hour = 24 * fractional_day - integer_hours;
732 int integer_minutes = (int)60 * fractional_hour;
733 double fractional_seconds = (60 * fractional_hour - integer_minutes) * 60;
737 ldate.
year = (short)year;
738 ldate.
day = (short)integer_days + 1;
739 ldate.
hour = (short)integer_hours;
740 ldate.
minute = (short)integer_minutes;
741 ldate.
second = fractional_seconds;
748 using namespace date;
749 using namespace std::chrono;
753 auto dp = date::sys_days(floor< date::days >(sys_tp));
756 date::year_month_day ymd{dp};
757 auto year_value = ymd.year();
759 auto ordinal_day = day_of_year(dp);
760 int integer_days = ordinal_day.count() - 1;
762 date::hh_mm_ss< std::chrono::nanoseconds > time{floor< std::chrono::nanoseconds >(sys_tp - dp)};
763 int ihours = time.hours().count();
764 int imins = time.minutes().count();
765 int isecs = time.seconds().count();
766 int inanos = time.subseconds().count();
769 floating_point_days = integer_days + frac_day;
770 year =
static_cast< int >(year_value);
775 double delta = (mjd - epoch_offset);
777 std::chrono::duration< double > duration_seconds(delta);
779 auto mjd_epoch_utc =
to_utc(mjd_epoch);
780 auto utc_time_point = mjd_epoch_utc + std::chrono::duration_cast< std::chrono::nanoseconds >(duration_seconds);
781 auto hops_time_point =
from_utc(utc_time_point);
782 return hops_time_point;
787 auto mjd_epoch_utc =
to_utc(mjd_epoch);
790 double delta = (tp_utc - mjd_epoch_utc).count();
793 delta += epoch_offset;
799 vex_date vdate = hops_clock::extract_vex_date(timestamp);
801 std::string vex_as_iso8601 = vex_date_to_iso8601_string(vdate);
807 using namespace date;
808 using namespace std::chrono;
812 auto dp = date::sys_days(floor< date::days >(sys_tp));
815 date::year_month_day ymd{dp};
816 auto year = ymd.year();
821 auto ordinal_day = day_of_year(dp);
824 date::hh_mm_ss< std::chrono::nanoseconds > time{floor< std::chrono::nanoseconds >(sys_tp - dp)};
825 auto hours = time.hours();
826 auto mins = time.minutes();
827 auto secs = time.seconds();
828 auto nanos = time.subseconds();
833 std::stringstream ss;
836 ss << std::setfill(
'0') << std::setw(3) << ordinal_day.count();
838 ss << std::setfill(
'0') << std::setw(2) << hours.count();
840 ss << std::setfill(
'0') << std::setw(2) << mins.count();
842 ss << std::setfill(
'0') << std::setw(2) << secs.count();
844 if(!truncate_to_nearest_second)
846 std::stringstream nss;
847 nss << std::setfill(
'0') << std::setw(9) << nanos.count();
848 std::string snano_sec;
850 std::string trimmed_nanosec = remove_trailing_zeros(snano_sec);
851 if(trimmed_nanosec.size() != 0)
854 ss << trimmed_nanosec;
864 using namespace date;
865 using namespace std::chrono;
869 auto dp = date::sys_days(floor< date::days >(sys_tp));
872 date::year_month_day ymd{dp};
873 auto year = ymd.year();
874 auto month = ymd.month();
875 auto day = ymd.day();
878 int iyear =
static_cast< int >(year);
879 unsigned int imonth =
static_cast< unsigned int >(month);
880 int epoch = (iyear % 100) * 2;
900 std::stringstream ss;
903 ss << std::setfill(
'0') << std::setw(2) << imonth;
905 ss << std::setfill('0') << std::setw(2) << static_cast< unsigned int >(day);
907 ss << std::setfill(
'0') << std::setw(2) << hours;
909 ss << std::setfill(
'0') << std::setw(2) << minutes;
911 ss << std::setfill(
'0') << std::setw(2) << integer_sec;
913 std::string epoch_iso8601 = ss.str();
915 int secs = std::chrono::duration_cast< std::chrono::seconds >(tp - epoch_tp).count();
923 using namespace date;
924 using namespace std::chrono;
926 int start_year = 2000;
927 int n_years = std::floor(vdif_epoch / 2);
928 int iyear = start_year + n_years;
930 unsigned int imonth = 1;
931 if(vdif_epoch % 2 == 1)
935 unsigned int iday = 1;
942 std::stringstream ss;
945 ss << std::setfill(
'0') << std::setw(2) << imonth;
947 ss << std::setfill(
'0') << std::setw(2) << iday;
949 ss << std::setfill(
'0') << std::setw(2) << hours;
951 ss << std::setfill(
'0') << std::setw(2) << minutes;
953 ss << std::setfill(
'0') << std::setw(2) << integer_sec;
955 std::string epoch_iso8601 = ss.str();
956 std::cout <<
"epoch = " << epoch_iso8601 << std::endl;
958 auto tp = epoch_tp + std::chrono::seconds(vdif_seconds);
962 inline hops_clock::vex_date hops_clock::extract_vex_date(
const std::string& timestamp)
965 if(timestamp.size() == 0)
967 msg_error(
"utilities",
"cannot extract vex date from empty string." << eom);
971 MHO_Tokenizer tokenizer;
972 std::vector< std::string >
tokens;
973 std::stringstream ss;
975 std::string syear, sord_day, shour, smin, ssec;
977 tokenizer.SetDelimiter(std::string(
"y"));
978 tokenizer.SetString(×tamp);
979 tokenizer.GetTokens(&
tokens);
986 tokenizer.SetDelimiter(std::string(
"d"));
987 tokenizer.SetString(&rest);
988 tokenizer.GetTokens(&
tokens);
991 ss.str(std::string());
994 ss >> vdate.day_of_year;
997 tokenizer.SetDelimiter(std::string(
"h"));
998 tokenizer.SetString(&rest);
999 tokenizer.GetTokens(&
tokens);
1002 ss.str(std::string());
1008 tokenizer.SetDelimiter(std::string(
"m"));
1009 tokenizer.SetString(&rest);
1010 tokenizer.GetTokens(&
tokens);
1013 ss.str(std::string());
1016 ss >> vdate.minutes;
1019 tokenizer.SetDelimiter(std::string(
"s"));
1020 tokenizer.SetString(&rest);
1021 tokenizer.GetTokens(&
tokens);
1024 ss.str(std::string());
1026 ss << std::setprecision(15) << ssec;
1027 ss >> vdate.seconds;
1032 inline std::string hops_clock::vex_date_to_iso8601_string(hops_clock::vex_date vdate)
1034 using namespace date;
1035 using namespace std::chrono;
1037 std::stringstream ss;
1042 date::days ord_day(vdate.day_of_year);
1043 date::sys_days ymd = get_year_month_day(y, ord_day);
1046 auto month = date::year_month_day{ymd}.month();
1047 auto mday = date::year_month_day{ymd}.day();
1048 ss << std::setfill(
'0') << std::setw(2) << (unsigned)month;
1050 ss << std::setfill(
'0') << std::setw(2) << (unsigned)mday;
1053 ss << std::setfill(
'0') << std::setw(2) << vdate.hours;
1055 ss << std::setfill(
'0') << std::setw(2) << vdate.minutes;
1061 double frac = modf(vdate.seconds, &intpart);
1062 int integer_sec = intpart;
1064 ss << std::setfill(
'0') << std::setw(2) << integer_sec;
1071 std::stringstream nss;
1072 nss << std::setfill(
'0') << std::setw(9) << integer_nanosec;
1073 std::string nanoseconds_value = nss.str();
1074 std::string trimmed_int_nanosec = remove_trailing_zeros(nanoseconds_value);
1075 if(trimmed_int_nanosec.size() != 0)
1078 ss << trimmed_int_nanosec;
1084 inline hops_clock::vex_date hops_clock::vex_date_from_legacy(
const legacy_hops_date& legacy_date)
1086 hops_clock::vex_date vdate;
1087 vdate.year = legacy_date.year;
1088 vdate.day_of_year = legacy_date.day;
1089 vdate.hours = legacy_date.hour;
1090 vdate.minutes = legacy_date.minute;
1091 vdate.seconds = legacy_date.second;
1099 std::size_t pos = 0;
1102 const int digit_counts[4] = {4, 3, 2, 2};
1103 const char separators[4] = {
'y',
'd',
'h',
'm'};
1108 for(
int i = 0; i < digit_counts[
field]; i++)
1110 if(pos >= s.size() || !std::isdigit(
static_cast< unsigned char >(s[pos])))
1117 if(pos >= s.size() || s[pos] != separators[
field])
1125 for(
int i = 0; i < 2; ++i)
1127 if(pos >= s.size() || !std::isdigit(
static_cast< unsigned char >(s[pos])))
1135 if(pos < s.size() && s[pos] ==
'.')
1138 if(pos >= s.size() || !std::isdigit(
static_cast< unsigned char >(s[pos])))
1143 while(pos < s.size() && std::isdigit(
static_cast< unsigned char >(s[pos])))
1150 if(pos >= s.size() || s[pos] !=
's')
1157 return pos == s.size();
#define ISO8601_UTC_FORMAT
Definition: MHO_Clock.hh:24
#define MINUTE_TO_SEC
Definition: MHO_Clock.hh:31
#define SEC_TO_NANOSEC
Definition: MHO_Clock.hh:29
#define HOPS_TIMESTAMP_PREFIX
Definition: MHO_Clock.hh:25
#define HOPS_TIME_DELIM
Definition: MHO_Clock.hh:26
#define NANOSEC_TO_SEC
Definition: MHO_Clock.hh:28
#define HOPS_TIME_UNIT
Definition: MHO_Clock.hh:27
#define JD_TO_SEC
Definition: MHO_Clock.hh:30
#define HOUR_TO_SEC
Definition: MHO_Clock.hh:32
#define msg_error(xKEY, xCONTENT)
Definition: MHO_Message.hh:247
Class MHO_Tokenizer.
Definition: MHO_Tokenizer.hh:24
void SetString(const std::string *aString)
Definition: MHO_Tokenizer.cc:65
void GetTokens(std::vector< std::string > *tokens)
Definition: MHO_Tokenizer.cc:75
void SetDelimiter(const std::string &aDelim)
Definition: MHO_Tokenizer.cc:70
a clock for hops-time stamps, measures time in (UTC) nanoseconds since J2000 epoch....
Definition: MHO_Clock.hh:49
static std::chrono::time_point< hops::tai_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > to_tai(const std::chrono::time_point< hops_clock, Duration > &) NOEXCEPT
Converts a time point from hops_clock to TAI (International Atomic Time).
static std::chrono::time_point< hops::utc_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > to_utc(const std::chrono::time_point< hops_clock, Duration > &) NOEXCEPT
Converts a time point to UTC using hops_clock and Duration.
static time_point get_hops_epoch()
returns the hops_clock epoch as a hops_clock time_point
Definition: MHO_Clock.hh:325
static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > from_gps(const std::chrono::time_point< hops::gps_clock, Duration > &) NOEXCEPT
Converts GPS time to Hops clock time.
duration::period period
Definition: MHO_Clock.hh:53
static void to_vdif_format(const time_point &tp, int &vdif_epoch, int &vdif_second)
Converts a hops_clock time_point to a VDIF (epoch, second) timestamp.
Definition: MHO_Clock.hh:862
static time_point now()
Returns current time as a time_point using hops_clock's epoch.
Definition: MHO_Clock.hh:511
std::chrono::time_point< hops_clock, std::chrono::nanoseconds > time_point
Definition: MHO_Clock.hh:54
static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > from_utc(const std::chrono::time_point< hops::utc_clock, Duration > &) NOEXCEPT
Converts UTC time point to hops_clock time point.
static std::chrono::time_point< std::chrono::system_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > to_sys(const std::chrono::time_point< hops_clock, Duration > &) NOEXCEPT
Converts a time point from hops_clock to system clock.
static bool is_vex_timestamp(const std::string &s)
Definition: MHO_Clock.hh:1097
static std::chrono::time_point< date::local_t, typename std::common_type< Duration, std::chrono::nanoseconds >::type > to_local(const std::chrono::time_point< hops_clock, Duration > &) NOEXCEPT
Converts a global time point to local time.
static std::string to_iso8601_format(const time_point &tp)
Converts a time_point to ISO8601 formatted string.
Definition: MHO_Clock.hh:626
static time_point from_year_fpday(int year, double floating_point_days)
Converts a year + floating point day since start of the year to a hops_clock time_point,...
Definition: MHO_Clock.hh:726
std::chrono::nanoseconds duration
Definition: MHO_Clock.hh:51
static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > from_sys(const std::chrono::time_point< std::chrono::system_clock, Duration > &) NOEXCEPT
Converts a system time point to UTC and returns the corresponding hops clock time.
static hops::utc_time< std::chrono::nanoseconds > get_hops_epoch_utc()
returns the hops_clock epoch as a utc_time time_point
Definition: MHO_Clock.hh:307
static time_point from_hops_format(const std::string ×tamp)
Converts a timestamp string in HOPS format to a time_point object.
Definition: MHO_Clock.hh:639
static time_point from_iso8601_format(const std::string ×tamp)
Converts an ISO8601 formatted timestamp string to a hops_clock time_point object.
Definition: MHO_Clock.hh:608
duration::rep rep
Definition: MHO_Clock.hh:52
static double to_mjd(const time_point &mjd_epoch, double epoch_offset, const time_point &tp)
Converts a hops_clock time_point to a Modified Julian date (floating point day) timestamp,...
Definition: MHO_Clock.hh:785
static time_point from_vdif_format(int &vdif_epoch, int &vdif_seconds)
Converts a VDIF (epoch, second) timestamp to a hops_clock time_point.
Definition: MHO_Clock.hh:921
static std::string to_vex_format(const time_point &tp, bool truncate_to_nearest_second=false)
Converts a hops_clock time_point to VEX-style formatted string (e.g. 2019y106d18h30m15s)
Definition: MHO_Clock.hh:805
static std::string to_hops_format(const time_point &tp)
Converts a time_point to HOPS format string.
Definition: MHO_Clock.hh:673
static time_point from_vex_format(const std::string ×tamp)
Converts a VEX-style formatted string (e.g. 2019y106d18h30m15s) to a hops_clock time_point.
Definition: MHO_Clock.hh:797
static std::chrono::seconds get_leap_seconds_between(const time_point &t_start, const time_point &t_end)
calculates the number of leap seconds inserted between two hops time points (UTC based clock)
Definition: MHO_Clock.hh:330
static time_point from_mjd(const time_point &mjd_epoch, double epoch_offset, double mjd)
Converts a Modified Julian date (floating point epoch and day) timestamp to a hops_clock time_point.
Definition: MHO_Clock.hh:773
static std::chrono::time_point< hops::gps_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > to_gps(const std::chrono::time_point< hops_clock, Duration > &) NOEXCEPT
Converts a time point to GPS clock time.
static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > from_tai(const std::chrono::time_point< hops::tai_clock, Duration > &) NOEXCEPT
Converts a TAI time point to UTC and returns the corresponding Hops clock time.
static const bool is_steady
Definition: MHO_Clock.hh:55
static legacy_hops_date to_legacy_hops_date(const time_point &tp)
Converts a hops_clock time_point to a legacy hops data struct.
Definition: MHO_Clock.hh:691
static void to_year_fpday(const time_point &tp, int &year, double &floating_point_days)
Converts a hops_clock time_point to a floating point day since start of the year needed for ad_hoc fl...
Definition: MHO_Clock.hh:746
static time_point from_legacy_hops_date(legacy_hops_date &ldate)
Converts a legacy hops data struct to a hops_clock time_point.
Definition: MHO_Clock.hh:684
static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > from_local(const std::chrono::time_point< date::local_t, Duration > &) NOEXCEPT
Calculates time difference between input local time and Hops epoch in UTC.
char * field(char *, char *, int)
Definition: fourmer.c:236
Self-contained (link-free) reimplementation of the small slice of the date library's tz facilities th...
short day
Definition: mk4_typedefs.h:17
short year
Definition: mk4_typedefs.h:16
Definition: mk4_typedefs.h:15
t
Definition: picking_aedit.py:14
Definition: MHO_AdhocFlagging.hh:18
std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, const hops_time< Duration > &t)
Definition: MHO_Clock.hh:596
short hour
Definition: legacy_hops_date.hh:20
std::basic_istream< CharT, Traits > & from_stream(std::basic_istream< CharT, Traits > &is, const CharT *fmt, hops_time< Duration > &tp, std::basic_string< CharT, Traits, Alloc > *abbrev=nullptr, std::chrono::minutes *offset=nullptr)
Reads time and abbreviation from stream using given format, updates hops_time if successful.
Definition: MHO_Clock.hh:585
leap_second_info get_leap_second_info(const utc_time< Duration > &ut)
Leap-second lookup for a utc_time, matching date::get_leap_second_info.
Definition: hops_leap_seconds.hh:164
std::chrono::time_point< gps_clock, Duration > gps_time
Definition: hops_leap_seconds.hh:159
short minute
Definition: legacy_hops_date.hh:21
short day
Definition: legacy_hops_date.hh:19
std::chrono::time_point< utc_clock, Duration > utc_time
Definition: hops_leap_seconds.hh:157
std::chrono::time_point< hops_clock, Duration > hops_time
Class hops_time.
Definition: MHO_Clock.hh:395
std::chrono::time_point< tai_clock, Duration > tai_time
Definition: hops_leap_seconds.hh:158
std::basic_ostream< CharT, Traits > & to_stream(std::basic_ostream< CharT, Traits > &os, const CharT *fmt, const hops_time< Duration > &t)
Converts hops_time to stream format using given fmt and outputs to os.
Definition: MHO_Clock.hh:562
double second
Definition: legacy_hops_date.hh:22
short year
Definition: legacy_hops_date.hh:18
A struct to avoid name collisions between the mk4utils 'data' struct and the 'date' header library.
Definition: legacy_hops_date.hh:17
struct token_struct * tokens
Definition: parse_control_file.c:26
static utc_time< Duration > to_utc(const gps_time< Duration > &t)
Definition: hops_leap_seconds.hh:292
static gps_time< Duration > from_utc(const utc_time< Duration > &t)
Definition: hops_leap_seconds.hh:297
static utc_time< Duration > to_utc(const tai_time< Duration > &t)
Definition: hops_leap_seconds.hh:270
static tai_time< Duration > from_utc(const utc_time< Duration > &t)
Definition: hops_leap_seconds.hh:275
static date::sys_time< typename std::common_type< Duration, std::chrono::seconds >::type > to_sys(const utc_time< Duration > &ut)
Definition: hops_leap_seconds.hh:231
static utc_time< typename std::common_type< Duration, std::chrono::seconds >::type > from_local(const date::local_time< Duration > <)
Definition: hops_leap_seconds.hh:248
static date::local_time< typename std::common_type< Duration, std::chrono::seconds >::type > to_local(const utc_time< Duration > &ut)
Definition: hops_leap_seconds.hh:240
static utc_time< std::chrono::nanoseconds > now()
Definition: hops_leap_seconds.hh:253
static utc_time< typename std::common_type< Duration, std::chrono::seconds >::type > from_sys(const date::sys_time< Duration > &st)
Definition: hops_leap_seconds.hh:221