11 #include "date/date.h"
21 #ifdef HOPS_USE_INTERNAL_LEAP_SECONDS
31 #define J2000_TAI_EPOCH "2000-01-01 11:59:27.816"
32 #define ISO8601_UTC_FORMAT "%FT%TZ"
33 #define HOPS_TIMESTAMP_PREFIX "HOPS-J2000"
34 #define HOPS_TIME_DELIM "|"
35 #define HOPS_TIME_UNIT "ns"
36 #define NANOSEC_TO_SEC 1e-9
37 #define SEC_TO_NANOSEC 1000000000
38 #define JD_TO_SEC 86400.0
39 #define MINUTE_TO_SEC 60.0
40 #define HOUR_TO_SEC 3600.0
46 #ifdef HOPS_USE_INTERNAL_LEAP_SECONDS
47 namespace hops_tz =
hops;
49 namespace hops_tz =
date;
69 using rep = duration::rep;
71 using time_point = std::chrono::time_point< hops_clock, std::chrono::nanoseconds >;
88 template<
typename Duration >
89 static std::chrono::time_point< hops_tz::utc_clock,
90 typename std::common_type< Duration, std::chrono::nanoseconds >::type >
91 to_utc(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
99 template<
typename Duration >
100 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
101 from_utc(
const std::chrono::time_point< hops_tz::utc_clock, Duration >&) NOEXCEPT;
109 template<
typename Duration >
110 static std::chrono::time_point< hops_tz::tai_clock,
111 typename std::common_type< Duration, std::chrono::nanoseconds >::type >
112 to_tai(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
120 template<
typename Duration >
121 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
122 from_tai(
const std::chrono::time_point< hops_tz::tai_clock, Duration >&) NOEXCEPT;
130 template<
typename Duration >
131 static std::chrono::time_point< hops_tz::gps_clock,
132 typename std::common_type< Duration, std::chrono::nanoseconds >::type >
133 to_gps(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
141 template<
typename Duration >
142 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
143 from_gps(
const std::chrono::time_point< hops_tz::gps_clock, Duration >&) NOEXCEPT;
151 template<
typename Duration >
152 static std::chrono::time_point< std::chrono::system_clock,
153 typename std::common_type< Duration, std::chrono::nanoseconds >::type >
154 to_sys(
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_sys(
const std::chrono::time_point< std::chrono::system_clock, Duration >&) NOEXCEPT;
172 template<
typename Duration >
173 static std::chrono::time_point< date::local_t, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
174 to_local(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
182 template<
typename Duration >
183 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
184 from_local(
const std::chrono::time_point< date::local_t, Duration >&) NOEXCEPT;
329 using namespace std::chrono;
335 auto days_since_tai_epoch = j2000_day - tai_epoch_day;
336 auto tod = hours{11} + minutes{59} + seconds{27} + milliseconds{816};
337 hops_tz::tai_time< nanoseconds > j2000_tai_epoch{duration_cast< nanoseconds >(days_since_tai_epoch) +
338 duration_cast< nanoseconds >(tod)};
339 return time_point_cast< nanoseconds >(hops_tz::tai_clock::to_utc(j2000_tai_epoch));
352 auto t_start_utc =
to_utc(t_start);
353 auto t_end_utc =
to_utc(t_end);
356 int delta = lp_info1.elapsed.count() - lp_info0.elapsed.count();
357 return std::chrono::seconds(delta);
361 static date::days day_of_year(date::sys_days sd)
363 using namespace date;
364 auto y = date::year_month_day{sd}.
year();
365 return sd - date::sys_days{y / jan / 0};
368 static date::sys_days get_year_month_day(
date::year y, date::days ord_day)
370 using namespace date;
371 return date::sys_days{y / jan / 0} + ord_day;
383 static vex_date extract_vex_date(
const std::string& timestamp);
385 static std::string vex_date_to_iso8601_string(vex_date vdate);
387 static vex_date vex_date_from_legacy(
const legacy_hops_date& legacy_date);
389 static std::string remove_trailing_zeros(std::string
value)
391 std::size_t nzeros_on_end = 0;
392 for(
auto rit =
value.rbegin(); rit !=
value.rend(); rit++)
400 std::size_t useful_length =
value.size() - nzeros_on_end;
402 for(std::size_t i = 0; i < useful_length; i++)
404 ret_val.push_back(
value[i]);
413 template<
class Duration >
using hops_time = std::chrono::time_point< hops_clock, Duration >;
421 template<
class Duration >
422 inline hops_tz::utc_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
426 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
427 hops_tz::utc_time< std::chrono::nanoseconds > hops_epoch_start =
get_hops_epoch_utc();
428 return hops_tz::utc_time< CD >(
t.time_since_epoch() + hops_epoch_start.time_since_epoch());
437 template<
class Duration >
441 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
442 hops_tz::utc_time< std::chrono::nanoseconds > hops_epoch_start =
get_hops_epoch_utc();
443 return hops_time< CD >(
t.time_since_epoch() - hops_epoch_start.time_since_epoch());
452 template<
class Duration >
453 inline hops_tz::tai_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
456 return hops_tz::tai_clock::from_utc(
to_utc(
t));
465 template<
class Duration >
469 return from_utc(hops_tz::tai_clock::to_utc(
t));
478 template<
class Duration >
479 inline hops_tz::gps_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
482 return hops_tz::gps_clock::from_utc(
to_utc(
t));
491 template<
class Duration >
495 return from_utc(hops_tz::gps_clock::to_utc(
t));
504 template<
class Duration >
505 inline date::sys_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
508 return hops_tz::utc_clock::to_sys(
to_utc(
t));
517 template<
class Duration >
521 return from_utc(hops_tz::utc_clock::from_sys(
t));
531 return from_utc(hops_tz::utc_clock::now());
540 template<
class Duration >
541 inline date::local_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
544 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
545 hops_tz::utc_time< CD > hops_epoch_start = std::chrono::time_point_cast< CD >(
get_hops_epoch_utc());
546 hops_tz::utc_time< CD > ut_time{
t.time_since_epoch() +
547 std::chrono::time_point_cast< Duration >(hops_epoch_start).time_since_epoch()};
548 return hops_tz::utc_clock::to_local(ut_time);
557 template<
class Duration >
561 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
562 hops_tz::utc_time< CD > t2 = hops_tz::utc_clock::from_local(
t);
563 hops_tz::utc_time< CD > hops_epoch_start = std::chrono::time_point_cast< CD >(
get_hops_epoch_utc());
565 std::chrono::time_point_cast< Duration >(hops_epoch_start).time_since_epoch()};
579 template<
class CharT,
class Traits,
class Duration >
580 std::basic_ostream< CharT, Traits >&
to_stream(std::basic_ostream< CharT, Traits >& os,
const CharT* fmt,
583 const std::string abbrev(
"HOPS");
584 CONSTDATA std::chrono::seconds offset{0};
601 template<
class Duration,
class CharT,
class Traits,
class Alloc = std::allocator< CharT > >
602 std::basic_istream< CharT, Traits >&
604 std::basic_string< CharT, Traits, Alloc >* abbrev =
nullptr, std::chrono::minutes* offset =
nullptr)
606 date::local_time< Duration > lp;
613 template<
class CharT,
class Traits,
class Duration >
614 std::basic_ostream< CharT, Traits >&
operator<<(std::basic_ostream< CharT, Traits >& os,
const hops_time< Duration >&
t)
616 const CharT fmt[] = {
'%',
'F',
'T',
'%',
'T',
'Z', CharT{}};
628 using namespace date;
629 using namespace std::chrono;
631 std::istringstream ss(timestamp);
632 std::istream tmp_stream(ss.rdbuf());
646 std::stringstream ss;
659 using namespace date;
660 using namespace std::chrono;
664 std::vector< std::string >
tokens;
669 std::string hops_prefix =
tokens[0];
670 std::string unit =
tokens[1];
671 std::string nanosecond_count =
tokens[2];
674 std::stringstream ss;
675 ss << nanosecond_count;
678 return time_point(std::chrono::nanoseconds(ns));
681 msg_error(
"utility",
"hops timestamp string not understood or supported, returning epoch start. " << eom);
682 return time_point(std::chrono::nanoseconds(0));
693 std::stringstream ss;
698 ss << tp.time_since_epoch().count();
704 vex_date vdate = vex_date_from_legacy(ldate);
705 std::string vex_as_iso8601 = vex_date_to_iso8601_string(vdate);
711 using namespace date;
712 using namespace std::chrono;
716 auto dp = date::sys_days(floor< date::days >(sys_tp));
719 date::year_month_day ymd{dp};
720 auto year = ymd.year();
723 auto ordinal_day = day_of_year(dp);
726 date::hh_mm_ss< std::chrono::nanoseconds > time{floor< std::chrono::nanoseconds >(sys_tp - dp)};
727 auto hours = time.hours();
728 auto mins = time.minutes();
729 auto secs = time.seconds();
730 auto nanos = time.subseconds();
733 ldate.
year = (int)year;
734 ldate.
day = ordinal_day.count();
735 ldate.
hour = hours.count();
736 ldate.
minute = mins.count();
746 int integer_days = (int)floating_point_days;
747 double fractional_day = floating_point_days - integer_days;
748 int integer_hours = (int)24 * fractional_day;
749 double fractional_hour = 24 * fractional_day - integer_hours;
750 int integer_minutes = (int)60 * fractional_hour;
751 double fractional_seconds = (60 * fractional_hour - integer_minutes) * 60;
755 ldate.
year = (short)year;
756 ldate.
day = (short)integer_days + 1;
757 ldate.
hour = (short)integer_hours;
758 ldate.
minute = (short)integer_minutes;
759 ldate.
second = fractional_seconds;
766 using namespace date;
767 using namespace std::chrono;
771 auto dp = date::sys_days(floor< date::days >(sys_tp));
774 date::year_month_day ymd{dp};
775 auto year_value = ymd.year();
777 auto ordinal_day = day_of_year(dp);
778 int integer_days = ordinal_day.count() - 1;
780 date::hh_mm_ss< std::chrono::nanoseconds > time{floor< std::chrono::nanoseconds >(sys_tp - dp)};
781 int ihours = time.hours().count();
782 int imins = time.minutes().count();
783 int isecs = time.seconds().count();
784 int inanos = time.subseconds().count();
787 floating_point_days = integer_days + frac_day;
792 double delta = (mjd - epoch_offset);
794 std::chrono::duration< double > duration_seconds(delta);
796 auto mjd_epoch_utc =
to_utc(mjd_epoch);
797 auto utc_time_point = mjd_epoch_utc + std::chrono::duration_cast< std::chrono::nanoseconds >(duration_seconds);
798 auto hops_time_point =
from_utc(utc_time_point);
799 return hops_time_point;
804 auto mjd_epoch_utc =
to_utc(mjd_epoch);
807 double delta = (tp_utc - mjd_epoch_utc).count();
810 delta += epoch_offset;
816 vex_date vdate = hops_clock::extract_vex_date(timestamp);
818 std::string vex_as_iso8601 = vex_date_to_iso8601_string(vdate);
824 using namespace date;
825 using namespace std::chrono;
829 auto dp = date::sys_days(floor< date::days >(sys_tp));
832 date::year_month_day ymd{dp};
833 auto year = ymd.year();
838 auto ordinal_day = day_of_year(dp);
841 date::hh_mm_ss< std::chrono::nanoseconds > time{floor< std::chrono::nanoseconds >(sys_tp - dp)};
842 auto hours = time.hours();
843 auto mins = time.minutes();
844 auto secs = time.seconds();
845 auto nanos = time.subseconds();
850 std::stringstream ss;
853 ss << std::setfill(
'0') << std::setw(3) << ordinal_day.count();
855 ss << std::setfill(
'0') << std::setw(2) << hours.count();
857 ss << std::setfill(
'0') << std::setw(2) << mins.count();
859 ss << std::setfill(
'0') << std::setw(2) << secs.count();
861 if(!truncate_to_nearest_second)
863 std::stringstream nss;
864 nss << std::setfill(
'0') << std::setw(9) << nanos.count();
865 std::string snano_sec;
867 std::string trimmed_nanosec = remove_trailing_zeros(snano_sec);
868 if(trimmed_nanosec.size() != 0)
871 ss << trimmed_nanosec;
881 using namespace date;
882 using namespace std::chrono;
886 auto dp = date::sys_days(floor< date::days >(sys_tp));
889 date::year_month_day ymd{dp};
890 auto year = ymd.year();
891 auto month = ymd.month();
892 auto day = ymd.day();
895 int iyear =
static_cast< int >(year);
896 unsigned int imonth =
static_cast< unsigned int >(month);
897 int epoch = (iyear % 100) * 2;
917 std::stringstream ss;
920 ss << std::setfill(
'0') << std::setw(2) << imonth;
922 ss << std::setfill('0') << std::setw(2) << static_cast< unsigned int >(day);
924 ss << std::setfill(
'0') << std::setw(2) << hours;
926 ss << std::setfill(
'0') << std::setw(2) << minutes;
928 ss << std::setfill(
'0') << std::setw(2) << integer_sec;
930 std::string epoch_iso8601 = ss.str();
932 int secs = std::chrono::duration_cast< std::chrono::seconds >(tp - epoch_tp).count();
940 using namespace date;
941 using namespace std::chrono;
943 int start_year = 2000;
944 int n_years = std::floor(vdif_epoch / 2);
945 int iyear = start_year + n_years;
947 std::cout <<
"n_years = " << n_years <<
" iyear = " << iyear << std::endl;
949 unsigned int imonth = 1;
950 if(vdif_epoch % 2 == 1)
954 unsigned int iday = 1;
961 std::stringstream ss;
964 ss << std::setfill(
'0') << std::setw(2) << imonth;
966 ss << std::setfill(
'0') << std::setw(2) << iday;
968 ss << std::setfill(
'0') << std::setw(2) << hours;
970 ss << std::setfill(
'0') << std::setw(2) << minutes;
972 ss << std::setfill(
'0') << std::setw(2) << integer_sec;
974 std::string epoch_iso8601 = ss.str();
975 std::cout <<
"epoch = " << epoch_iso8601 << std::endl;
977 auto tp = epoch_tp + std::chrono::seconds(vdif_seconds);
981 inline hops_clock::vex_date hops_clock::extract_vex_date(
const std::string& timestamp)
984 if(timestamp.size() == 0)
986 msg_error(
"utilities",
"cannot extract vex date from empty string." << eom);
990 MHO_Tokenizer tokenizer;
991 std::vector< std::string >
tokens;
992 std::stringstream ss;
994 std::string syear, sord_day, shour, smin, ssec;
996 tokenizer.SetDelimiter(std::string(
"y"));
997 tokenizer.SetString(×tamp);
998 tokenizer.GetTokens(&
tokens);
1005 tokenizer.SetDelimiter(std::string(
"d"));
1006 tokenizer.SetString(&rest);
1007 tokenizer.GetTokens(&
tokens);
1010 ss.str(std::string());
1013 ss >> vdate.day_of_year;
1016 tokenizer.SetDelimiter(std::string(
"h"));
1017 tokenizer.SetString(&rest);
1018 tokenizer.GetTokens(&
tokens);
1021 ss.str(std::string());
1027 tokenizer.SetDelimiter(std::string(
"m"));
1028 tokenizer.SetString(&rest);
1029 tokenizer.GetTokens(&
tokens);
1032 ss.str(std::string());
1035 ss >> vdate.minutes;
1038 tokenizer.SetDelimiter(std::string(
"s"));
1039 tokenizer.SetString(&rest);
1040 tokenizer.GetTokens(&
tokens);
1043 ss.str(std::string());
1045 ss << std::setprecision(15) << ssec;
1046 ss >> vdate.seconds;
1051 inline std::string hops_clock::vex_date_to_iso8601_string(hops_clock::vex_date vdate)
1053 using namespace date;
1054 using namespace std::chrono;
1056 std::stringstream ss;
1061 date::days ord_day(vdate.day_of_year);
1062 date::sys_days ymd = get_year_month_day(y, ord_day);
1065 auto month = date::year_month_day{ymd}.month();
1066 auto mday = date::year_month_day{ymd}.day();
1067 ss << std::setfill(
'0') << std::setw(2) << (unsigned)month;
1069 ss << std::setfill(
'0') << std::setw(2) << (unsigned)mday;
1072 ss << std::setfill(
'0') << std::setw(2) << vdate.hours;
1074 ss << std::setfill(
'0') << std::setw(2) << vdate.minutes;
1080 double frac = modf(vdate.seconds, &intpart);
1081 int integer_sec = intpart;
1083 ss << std::setfill(
'0') << std::setw(2) << integer_sec;
1090 std::stringstream nss;
1091 nss << std::setfill(
'0') << std::setw(9) << integer_nanosec;
1092 std::string nanoseconds_value = nss.str();
1093 std::string trimmed_int_nanosec = remove_trailing_zeros(nanoseconds_value);
1094 if(trimmed_int_nanosec.size() != 0)
1097 ss << trimmed_int_nanosec;
1103 inline hops_clock::vex_date hops_clock::vex_date_from_legacy(
const legacy_hops_date& legacy_date)
1105 hops_clock::vex_date vdate;
1106 vdate.year = legacy_date.year;
1107 vdate.day_of_year = legacy_date.day;
1108 vdate.hours = legacy_date.hour;
1109 vdate.minutes = legacy_date.minute;
1110 vdate.seconds = legacy_date.second;
#define ISO8601_UTC_FORMAT
Definition: MHO_Clock.hh:32
#define MINUTE_TO_SEC
Definition: MHO_Clock.hh:39
#define SEC_TO_NANOSEC
Definition: MHO_Clock.hh:37
#define HOPS_TIMESTAMP_PREFIX
Definition: MHO_Clock.hh:33
#define HOPS_TIME_DELIM
Definition: MHO_Clock.hh:34
#define NANOSEC_TO_SEC
Definition: MHO_Clock.hh:36
#define HOPS_TIME_UNIT
Definition: MHO_Clock.hh:35
#define JD_TO_SEC
Definition: MHO_Clock.hh:38
#define HOUR_TO_SEC
Definition: MHO_Clock.hh:40
#define msg_error(xKEY, xCONTENT)
Definition: MHO_Message.hh:238
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:66
static std::chrono::time_point< hops_tz::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 time_point get_hops_epoch()
returns the hops_clock epoch as a hops_clock time_point
Definition: MHO_Clock.hh:345
duration::period period
Definition: MHO_Clock.hh:70
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:879
static time_point now()
Returns current time as a time_point using hops_clock's epoch.
Definition: MHO_Clock.hh:529
std::chrono::time_point< hops_clock, std::chrono::nanoseconds > time_point
Definition: MHO_Clock.hh:71
static std::chrono::time_point< hops_tz::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< 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 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:644
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:744
std::chrono::nanoseconds duration
Definition: MHO_Clock.hh:68
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 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:657
static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > from_gps(const std::chrono::time_point< hops_tz::gps_clock, Duration > &) NOEXCEPT
Converts GPS time to Hops clock time.
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:626
duration::rep rep
Definition: MHO_Clock.hh:69
static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > from_utc(const std::chrono::time_point< hops_tz::utc_clock, Duration > &) NOEXCEPT
Converts UTC time point to hops_clock time point.
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:802
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:938
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:822
static std::chrono::time_point< hops_tz::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 hops_tz::utc_time< std::chrono::nanoseconds > get_hops_epoch_utc()
returns the hops_clock epoch as a utc_time time_point
Definition: MHO_Clock.hh:327
static std::string to_hops_format(const time_point &tp)
Converts a time_point to HOPS format string.
Definition: MHO_Clock.hh:691
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:814
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:350
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:790
static const bool is_steady
Definition: MHO_Clock.hh:72
static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > from_tai(const std::chrono::time_point< hops_tz::tai_clock, Duration > &) NOEXCEPT
Converts a TAI time point to UTC and returns the corresponding Hops clock time.
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:709
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:764
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:702
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.
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:614
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:603
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:171
short minute
Definition: legacy_hops_date.hh:21
short day
Definition: legacy_hops_date.hh:19
std::chrono::time_point< hops_clock, Duration > hops_time
Class hops_time.
Definition: MHO_Clock.hh:413
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:580
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