11 #include "date/date.h"
18 #define J2000_TAI_EPOCH "2000-01-01 11:59:27.816"
19 #define ISO8601_UTC_FORMAT "%FT%TZ"
20 #define HOPS_TIMESTAMP_PREFIX "HOPS-J2000"
21 #define HOPS_TIME_DELIM "|"
22 #define HOPS_TIME_UNIT "ns"
23 #define NANOSEC_TO_SEC 1e-9
24 #define SEC_TO_NANOSEC 1000000000
25 #define JD_TO_SEC 86400.0
26 #define MINUTE_TO_SEC 60.0
27 #define HOUR_TO_SEC 3600.0
46 using rep = duration::rep;
48 using time_point = std::chrono::time_point< hops_clock, std::chrono::nanoseconds >;
65 template<
typename Duration >
66 static std::chrono::time_point< date::utc_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
67 to_utc(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
75 template<
typename Duration >
76 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
77 from_utc(
const std::chrono::time_point< date::utc_clock, Duration >&) NOEXCEPT;
85 template<
typename Duration >
86 static std::chrono::time_point< date::tai_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
87 to_tai(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
95 template<
typename Duration >
96 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
97 from_tai(
const std::chrono::time_point< date::tai_clock, Duration >&) NOEXCEPT;
105 template<
typename Duration >
106 static std::chrono::time_point< date::gps_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
107 to_gps(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
115 template<
typename Duration >
116 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
117 from_gps(
const std::chrono::time_point< date::gps_clock, Duration >&) NOEXCEPT;
125 template<
typename Duration >
126 static std::chrono::time_point< std::chrono::system_clock,
127 typename std::common_type< Duration, std::chrono::nanoseconds >::type >
128 to_sys(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
136 template<
typename Duration >
137 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
138 from_sys(
const std::chrono::time_point< std::chrono::system_clock, Duration >&) NOEXCEPT;
146 template<
typename Duration >
147 static std::chrono::time_point< date::local_t, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
148 to_local(
const std::chrono::time_point< hops_clock, Duration >&) NOEXCEPT;
156 template<
typename Duration >
157 static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type >
158 from_local(
const std::chrono::time_point< date::local_t, Duration >&) NOEXCEPT;
303 std::string frmt =
"%F %T";
305 date::tai_time< std::chrono::nanoseconds > j2000_tai_epoch;
306 std::istringstream ss(j2000);
307 std::istream stream(ss.rdbuf());
309 return std::chrono::time_point_cast< std::chrono::nanoseconds >(date::tai_clock::to_utc(j2000_tai_epoch));
322 auto t_start_utc =
to_utc(t_start);
323 auto t_end_utc =
to_utc(t_end);
324 auto lp_info0 = date::get_leap_second_info(t_start_utc);
325 auto lp_info1 = date::get_leap_second_info(t_end_utc);
326 int delta = lp_info1.elapsed.count() - lp_info0.elapsed.count();
327 return std::chrono::seconds(delta);
331 static date::days day_of_year(date::sys_days sd)
333 using namespace date;
334 auto y = date::year_month_day{sd}.
year();
335 return sd - date::sys_days{y / jan / 0};
338 static date::sys_days get_year_month_day(
date::year y, date::days ord_day)
340 using namespace date;
341 return date::sys_days{y / jan / 0} + ord_day;
353 static vex_date extract_vex_date(
const std::string& timestamp);
355 static std::string vex_date_to_iso8601_string(vex_date vdate);
357 static vex_date vex_date_from_legacy(
const legacy_hops_date& legacy_date);
359 static std::string remove_trailing_zeros(std::string
value)
361 std::size_t nzeros_on_end = 0;
362 for(
auto rit =
value.rbegin(); rit !=
value.rend(); rit++)
370 std::size_t useful_length =
value.size() - nzeros_on_end;
372 for(std::size_t i = 0; i < useful_length; i++)
374 ret_val.push_back(
value[i]);
383 template<
class Duration >
using hops_time = std::chrono::time_point< hops_clock, Duration >;
391 template<
class Duration >
392 inline date::utc_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
396 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
398 return date::utc_time< CD >(
t.time_since_epoch() + hops_epoch_start.time_since_epoch());
407 template<
class Duration >
411 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
413 return hops_time< CD >(
t.time_since_epoch() - hops_epoch_start.time_since_epoch());
422 template<
class Duration >
423 inline date::tai_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
426 return date::tai_clock::from_utc(
to_utc(
t));
435 template<
class Duration >
439 return from_utc(date::tai_clock::to_utc(
t));
448 template<
class Duration >
449 inline date::gps_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
452 return date::gps_clock::from_utc(
to_utc(
t));
461 template<
class Duration >
465 return from_utc(date::gps_clock::to_utc(
t));
474 template<
class Duration >
475 inline date::sys_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
478 return date::utc_clock::to_sys(
to_utc(
t));
487 template<
class Duration >
491 return from_utc(date::utc_clock::from_sys(
t));
501 return from_utc(date::utc_clock::now());
510 template<
class Duration >
511 inline date::local_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
514 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
515 date::utc_time< CD > hops_epoch_start = std::chrono::time_point_cast< CD >(
get_hops_epoch_utc());
516 date::utc_time< CD > ut_time{
t.time_since_epoch() +
517 std::chrono::time_point_cast< Duration >(hops_epoch_start).time_since_epoch()};
518 return date::utc_clock::to_local(ut_time);
527 template<
class Duration >
531 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
532 date::utc_time< CD > t2 = date::utc_clock::from_local(
t);
533 date::utc_time< CD > hops_epoch_start = std::chrono::time_point_cast< CD >(
get_hops_epoch_utc());
535 std::chrono::time_point_cast< Duration >(hops_epoch_start).time_since_epoch()};
549 template<
class CharT,
class Traits,
class Duration >
550 std::basic_ostream< CharT, Traits >&
to_stream(std::basic_ostream< CharT, Traits >& os,
const CharT* fmt,
553 const std::string abbrev(
"HOPS");
554 CONSTDATA std::chrono::seconds offset{0};
571 template<
class Duration,
class CharT,
class Traits,
class Alloc = std::allocator< CharT > >
572 std::basic_istream< CharT, Traits >&
574 std::basic_string< CharT, Traits, Alloc >* abbrev =
nullptr, std::chrono::minutes* offset =
nullptr)
576 date::local_time< Duration > lp;
583 template<
class CharT,
class Traits,
class Duration >
584 std::basic_ostream< CharT, Traits >&
operator<<(std::basic_ostream< CharT, Traits >& os,
const hops_time< Duration >&
t)
586 const CharT fmt[] = {
'%',
'F',
'T',
'%',
'T',
'Z', CharT{}};
598 using namespace date;
599 using namespace std::chrono;
601 std::istringstream ss(timestamp);
602 std::istream tmp_stream(ss.rdbuf());
616 std::stringstream ss;
629 using namespace date;
630 using namespace std::chrono;
634 std::vector< std::string >
tokens;
639 std::string hops_prefix =
tokens[0];
640 std::string unit =
tokens[1];
641 std::string nanosecond_count =
tokens[2];
644 std::stringstream ss;
645 ss << nanosecond_count;
648 return time_point(std::chrono::nanoseconds(ns));
651 msg_error(
"utility",
"hops timestamp string not understood or supported, returning epoch start. " << eom);
652 return time_point(std::chrono::nanoseconds(0));
663 std::stringstream ss;
668 ss << tp.time_since_epoch().count();
674 vex_date vdate = vex_date_from_legacy(ldate);
675 std::string vex_as_iso8601 = vex_date_to_iso8601_string(vdate);
681 using namespace date;
682 using namespace std::chrono;
686 auto dp = date::sys_days(floor< date::days >(sys_tp));
689 date::year_month_day ymd{dp};
690 auto year = ymd.year();
693 auto ordinal_day = day_of_year(dp);
696 date::hh_mm_ss< std::chrono::nanoseconds > time{floor< std::chrono::nanoseconds >(sys_tp - dp)};
697 auto hours = time.hours();
698 auto mins = time.minutes();
699 auto secs = time.seconds();
700 auto nanos = time.subseconds();
703 ldate.
year = (int)year;
704 ldate.
day = ordinal_day.count();
705 ldate.
hour = hours.count();
706 ldate.
minute = mins.count();
716 int integer_days = (int)floating_point_days;
717 double fractional_day = floating_point_days - integer_days;
718 int integer_hours = (int)24 * fractional_day;
719 double fractional_hour = 24 * fractional_day - integer_hours;
720 int integer_minutes = (int)60 * fractional_hour;
721 double fractional_seconds = (60 * fractional_hour - integer_minutes) * 60;
725 ldate.
year = (short)year;
726 ldate.
day = (short)integer_days + 1;
727 ldate.
hour = (short)integer_hours;
728 ldate.
minute = (short)integer_minutes;
729 ldate.
second = fractional_seconds;
736 using namespace date;
737 using namespace std::chrono;
741 auto dp = date::sys_days(floor< date::days >(sys_tp));
744 date::year_month_day ymd{dp};
745 auto year_value = ymd.year();
747 auto ordinal_day = day_of_year(dp);
748 int integer_days = ordinal_day.count() - 1;
750 date::hh_mm_ss< std::chrono::nanoseconds > time{floor< std::chrono::nanoseconds >(sys_tp - dp)};
751 int ihours = time.hours().count();
752 int imins = time.minutes().count();
753 int isecs = time.seconds().count();
754 int inanos = time.subseconds().count();
757 floating_point_days = integer_days + frac_day;
762 double delta = (mjd - epoch_offset);
764 std::chrono::duration< double > duration_seconds(delta);
766 auto mjd_epoch_utc =
to_utc(mjd_epoch);
767 auto utc_time_point = mjd_epoch_utc + std::chrono::duration_cast< std::chrono::nanoseconds >(duration_seconds);
768 auto hops_time_point =
from_utc(utc_time_point);
769 return hops_time_point;
774 auto mjd_epoch_utc =
to_utc(mjd_epoch);
777 double delta = (tp_utc - mjd_epoch_utc).count();
780 delta += epoch_offset;
786 vex_date vdate = hops_clock::extract_vex_date(timestamp);
788 std::string vex_as_iso8601 = vex_date_to_iso8601_string(vdate);
794 using namespace date;
795 using namespace std::chrono;
799 auto dp = date::sys_days(floor< date::days >(sys_tp));
802 date::year_month_day ymd{dp};
803 auto year = ymd.year();
808 auto ordinal_day = day_of_year(dp);
811 date::hh_mm_ss< std::chrono::nanoseconds > time{floor< std::chrono::nanoseconds >(sys_tp - dp)};
812 auto hours = time.hours();
813 auto mins = time.minutes();
814 auto secs = time.seconds();
815 auto nanos = time.subseconds();
820 std::stringstream ss;
823 ss << std::setfill(
'0') << std::setw(3) << ordinal_day.count();
825 ss << std::setfill(
'0') << std::setw(2) << hours.count();
827 ss << std::setfill(
'0') << std::setw(2) << mins.count();
829 ss << std::setfill(
'0') << std::setw(2) << secs.count();
831 if(!truncate_to_nearest_second)
833 std::stringstream nss;
834 nss << std::setfill(
'0') << std::setw(9) << nanos.count();
835 std::string snano_sec;
837 std::string trimmed_nanosec = remove_trailing_zeros(snano_sec);
838 if(trimmed_nanosec.size() != 0)
841 ss << trimmed_nanosec;
851 using namespace date;
852 using namespace std::chrono;
856 auto dp = date::sys_days(floor< date::days >(sys_tp));
859 date::year_month_day ymd{dp};
860 auto year = ymd.year();
861 auto month = ymd.month();
862 auto day = ymd.day();
865 int iyear =
static_cast< int >(year);
866 unsigned int imonth =
static_cast< unsigned int >(month);
867 int epoch = (iyear % 100) * 2;
887 std::stringstream ss;
890 ss << std::setfill(
'0') << std::setw(2) << imonth;
892 ss << std::setfill('0') << std::setw(2) << static_cast< unsigned int >(day);
894 ss << std::setfill(
'0') << std::setw(2) << hours;
896 ss << std::setfill(
'0') << std::setw(2) << minutes;
898 ss << std::setfill(
'0') << std::setw(2) << integer_sec;
900 std::string epoch_iso8601 = ss.str();
902 int secs = std::chrono::duration_cast< std::chrono::seconds >(tp - epoch_tp).count();
910 using namespace date;
911 using namespace std::chrono;
913 int start_year = 2000;
914 int n_years = std::floor(vdif_epoch / 2);
915 int iyear = start_year + n_years;
917 std::cout <<
"n_years = " << n_years <<
" iyear = " << iyear << std::endl;
919 unsigned int imonth = 1;
920 if(vdif_epoch % 2 == 1)
924 unsigned int iday = 1;
931 std::stringstream ss;
934 ss << std::setfill(
'0') << std::setw(2) << imonth;
936 ss << std::setfill(
'0') << std::setw(2) << iday;
938 ss << std::setfill(
'0') << std::setw(2) << hours;
940 ss << std::setfill(
'0') << std::setw(2) << minutes;
942 ss << std::setfill(
'0') << std::setw(2) << integer_sec;
944 std::string epoch_iso8601 = ss.str();
945 std::cout <<
"epoch = " << epoch_iso8601 << std::endl;
947 auto tp = epoch_tp + std::chrono::seconds(vdif_seconds);
951 inline hops_clock::vex_date hops_clock::extract_vex_date(
const std::string& timestamp)
954 if(timestamp.size() == 0)
956 msg_error(
"utilities",
"cannot extract vex date from empty string." << eom);
960 MHO_Tokenizer tokenizer;
961 std::vector< std::string >
tokens;
962 std::stringstream ss;
964 std::string syear, sord_day, shour, smin, ssec;
966 tokenizer.SetDelimiter(std::string(
"y"));
967 tokenizer.SetString(×tamp);
968 tokenizer.GetTokens(&
tokens);
975 tokenizer.SetDelimiter(std::string(
"d"));
976 tokenizer.SetString(&rest);
977 tokenizer.GetTokens(&
tokens);
980 ss.str(std::string());
983 ss >> vdate.day_of_year;
986 tokenizer.SetDelimiter(std::string(
"h"));
987 tokenizer.SetString(&rest);
988 tokenizer.GetTokens(&
tokens);
991 ss.str(std::string());
997 tokenizer.SetDelimiter(std::string(
"m"));
998 tokenizer.SetString(&rest);
999 tokenizer.GetTokens(&
tokens);
1002 ss.str(std::string());
1005 ss >> vdate.minutes;
1008 tokenizer.SetDelimiter(std::string(
"s"));
1009 tokenizer.SetString(&rest);
1010 tokenizer.GetTokens(&
tokens);
1013 ss.str(std::string());
1015 ss << std::setprecision(15) << ssec;
1016 ss >> vdate.seconds;
1021 inline std::string hops_clock::vex_date_to_iso8601_string(hops_clock::vex_date vdate)
1023 using namespace date;
1024 using namespace std::chrono;
1026 std::stringstream ss;
1031 date::days ord_day(vdate.day_of_year);
1032 date::sys_days ymd = get_year_month_day(y, ord_day);
1035 auto month = date::year_month_day{ymd}.month();
1036 auto mday = date::year_month_day{ymd}.day();
1037 ss << std::setfill(
'0') << std::setw(2) << (unsigned)month;
1039 ss << std::setfill(
'0') << std::setw(2) << (unsigned)mday;
1042 ss << std::setfill(
'0') << std::setw(2) << vdate.hours;
1044 ss << std::setfill(
'0') << std::setw(2) << vdate.minutes;
1050 double frac = modf(vdate.seconds, &intpart);
1051 int integer_sec = intpart;
1053 ss << std::setfill(
'0') << std::setw(2) << integer_sec;
1060 std::stringstream nss;
1061 nss << std::setfill(
'0') << std::setw(9) << integer_nanosec;
1062 std::string nanoseconds_value = nss.str();
1063 std::string trimmed_int_nanosec = remove_trailing_zeros(nanoseconds_value);
1064 if(trimmed_int_nanosec.size() != 0)
1067 ss << trimmed_int_nanosec;
1073 inline hops_clock::vex_date hops_clock::vex_date_from_legacy(
const legacy_hops_date& legacy_date)
1075 hops_clock::vex_date vdate;
1076 vdate.year = legacy_date.year;
1077 vdate.day_of_year = legacy_date.day;
1078 vdate.hours = legacy_date.hour;
1079 vdate.minutes = legacy_date.minute;
1080 vdate.seconds = legacy_date.second;
#define ISO8601_UTC_FORMAT
Definition: MHO_Clock.hh:19
#define J2000_TAI_EPOCH
Definition: MHO_Clock.hh:18
#define MINUTE_TO_SEC
Definition: MHO_Clock.hh:26
#define SEC_TO_NANOSEC
Definition: MHO_Clock.hh:24
#define HOPS_TIMESTAMP_PREFIX
Definition: MHO_Clock.hh:20
#define HOPS_TIME_DELIM
Definition: MHO_Clock.hh:21
#define NANOSEC_TO_SEC
Definition: MHO_Clock.hh:23
#define HOPS_TIME_UNIT
Definition: MHO_Clock.hh:22
#define JD_TO_SEC
Definition: MHO_Clock.hh:25
#define HOUR_TO_SEC
Definition: MHO_Clock.hh:27
#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:43
static date::utc_time< std::chrono::nanoseconds > get_hops_epoch_utc()
returns the hops_clock epoch as a utc_time time_point
Definition: MHO_Clock.hh:301
static time_point get_hops_epoch()
returns the hops_clock epoch as a hops_clock time_point
Definition: MHO_Clock.hh:315
duration::period period
Definition: MHO_Clock.hh:47
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:849
static std::chrono::time_point< date::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 time_point now()
Returns current time as a time_point using hops_clock's epoch.
Definition: MHO_Clock.hh:499
std::chrono::time_point< hops_clock, std::chrono::nanoseconds > time_point
Definition: MHO_Clock.hh:48
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:614
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:714
static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > from_tai(const std::chrono::time_point< date::tai_clock, Duration > &) NOEXCEPT
Converts a TAI time point to UTC and returns the corresponding Hops clock time.
std::chrono::nanoseconds duration
Definition: MHO_Clock.hh:45
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:627
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:596
duration::rep rep
Definition: MHO_Clock.hh:46
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:772
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:908
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:792
static std::string to_hops_format(const time_point &tp)
Converts a time_point to HOPS format string.
Definition: MHO_Clock.hh:661
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:784
static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > from_gps(const std::chrono::time_point< date::gps_clock, Duration > &) NOEXCEPT
Converts GPS time to Hops clock time.
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:320
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:760
static std::chrono::time_point< date::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 const bool is_steady
Definition: MHO_Clock.hh:49
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:679
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:734
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:672
static std::chrono::time_point< hops_clock, typename std::common_type< Duration, std::chrono::nanoseconds >::type > from_utc(const std::chrono::time_point< date::utc_clock, Duration > &) NOEXCEPT
Converts UTC time point to hops_clock time point.
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.
static std::chrono::time_point< date::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.
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:584
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:573
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:383
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:550
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