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;
305 std::string frmt =
"%F %T";
307 date::tai_time< std::chrono::nanoseconds > j2000_tai_epoch;
308 std::istringstream ss(j2000);
309 std::istream stream(ss.rdbuf());
311 return std::chrono::time_point_cast< std::chrono::nanoseconds >(date::tai_clock::to_utc(j2000_tai_epoch));
324 auto t_start_utc =
to_utc(t_start);
325 auto t_end_utc =
to_utc(t_end);
326 auto lp_info0 = date::get_leap_second_info(t_start_utc);
327 auto lp_info1 = date::get_leap_second_info(t_end_utc);
328 int delta = lp_info1.elapsed.count() - lp_info0.elapsed.count();
329 return std::chrono::seconds(delta);
334 static date::days day_of_year(date::sys_days sd)
336 using namespace date;
337 auto y = date::year_month_day{sd}.
year();
338 return sd - date::sys_days{y / jan / 0};
341 static date::sys_days get_year_month_day(
date::year y, date::days ord_day)
343 using namespace date;
344 return date::sys_days{y / jan / 0} + ord_day;
356 static vex_date extract_vex_date(
const std::string& timestamp);
358 static std::string vex_date_to_iso8601_string(vex_date vdate);
360 static vex_date vex_date_from_legacy(
const legacy_hops_date& legacy_date);
362 static std::string remove_trailing_zeros(std::string
value)
364 std::size_t nzeros_on_end = 0;
365 for(
auto rit =
value.rbegin(); rit !=
value.rend(); rit++)
373 std::size_t useful_length =
value.size() - nzeros_on_end;
375 for(std::size_t i = 0; i < useful_length; i++)
377 ret_val.push_back(
value[i]);
386 template<
class Duration >
using hops_time = std::chrono::time_point< hops_clock, Duration >;
394 template<
class Duration >
395 inline date::utc_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
399 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
401 return date::utc_time< CD >(
t.time_since_epoch() + hops_epoch_start.time_since_epoch());
410 template<
class Duration >
414 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
416 return hops_time< CD >(
t.time_since_epoch() - hops_epoch_start.time_since_epoch());
425 template<
class Duration >
426 inline date::tai_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
429 return date::tai_clock::from_utc(
to_utc(
t));
438 template<
class Duration >
442 return from_utc(date::tai_clock::to_utc(
t));
451 template<
class Duration >
452 inline date::gps_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
455 return date::gps_clock::from_utc(
to_utc(
t));
464 template<
class Duration >
468 return from_utc(date::gps_clock::to_utc(
t));
477 template<
class Duration >
478 inline date::sys_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
481 return date::utc_clock::to_sys(
to_utc(
t));
490 template<
class Duration >
494 return from_utc(date::utc_clock::from_sys(
t));
504 return from_utc(date::utc_clock::now());
513 template<
class Duration >
514 inline date::local_time< typename std::common_type< Duration, std::chrono::nanoseconds >::type >
517 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
518 date::utc_time< CD > hops_epoch_start = std::chrono::time_point_cast< CD >(
get_hops_epoch_utc());
519 date::utc_time< CD > ut_time{
t.time_since_epoch() +
520 std::chrono::time_point_cast< Duration >(hops_epoch_start).time_since_epoch()};
521 return date::utc_clock::to_local(ut_time);
530 template<
class Duration >
534 using CD =
typename std::common_type< Duration, std::chrono::nanoseconds >::type;
535 date::utc_time< CD > t2 = date::utc_clock::from_local(
t);
536 date::utc_time< CD > hops_epoch_start = std::chrono::time_point_cast< CD >(
get_hops_epoch_utc());
538 std::chrono::time_point_cast< Duration >(hops_epoch_start).time_since_epoch()};
552 template<
class CharT,
class Traits,
class Duration >
553 std::basic_ostream< CharT, Traits >&
to_stream(std::basic_ostream< CharT, Traits >& os,
const CharT* fmt,
556 const std::string abbrev(
"HOPS");
557 CONSTDATA std::chrono::seconds offset{0};
574 template<
class Duration,
class CharT,
class Traits,
class Alloc = std::allocator< CharT > >
575 std::basic_istream< CharT, Traits >&
577 std::basic_string< CharT, Traits, Alloc >* abbrev =
nullptr, std::chrono::minutes* offset =
nullptr)
579 date::local_time< Duration > lp;
586 template<
class CharT,
class Traits,
class Duration >
587 std::basic_ostream< CharT, Traits >&
operator<<(std::basic_ostream< CharT, Traits >& os,
const hops_time< Duration >&
t)
589 const CharT fmt[] = {
'%',
'F',
'T',
'%',
'T',
'Z', CharT{}};
601 using namespace date;
602 using namespace std::chrono;
604 std::istringstream ss(timestamp);
605 std::istream tmp_stream(ss.rdbuf());
619 std::stringstream ss;
632 using namespace date;
633 using namespace std::chrono;
637 std::vector< std::string >
tokens;
642 std::string hops_prefix =
tokens[0];
643 std::string unit =
tokens[1];
644 std::string nanosecond_count =
tokens[2];
647 std::stringstream ss;
648 ss << nanosecond_count;
651 return time_point(std::chrono::nanoseconds(ns));
654 msg_error(
"utility",
"hops timestamp string not understood or supported, returning epoch start. " << eom);
655 return time_point(std::chrono::nanoseconds(0));
666 std::stringstream ss;
671 ss << tp.time_since_epoch().count();
677 vex_date vdate = vex_date_from_legacy(ldate);
678 std::string vex_as_iso8601 = vex_date_to_iso8601_string(vdate);
684 using namespace date;
685 using namespace std::chrono;
689 auto dp = date::sys_days(floor< date::days >(sys_tp));
692 date::year_month_day ymd{dp};
693 auto year = ymd.year();
696 auto ordinal_day = day_of_year(dp);
699 date::hh_mm_ss< std::chrono::nanoseconds > time{floor< std::chrono::nanoseconds >(sys_tp - dp)};
700 auto hours = time.hours();
701 auto mins = time.minutes();
702 auto secs = time.seconds();
703 auto nanos = time.subseconds();
706 ldate.
year = (int)year;
707 ldate.
day = ordinal_day.count();
708 ldate.
hour = hours.count();
709 ldate.
minute = mins.count();
720 int integer_days = (int) floating_point_days;
721 double fractional_day = floating_point_days - integer_days;
722 int integer_hours = (int) 24*fractional_day;
723 double fractional_hour = 24*fractional_day - integer_hours;
724 int integer_minutes = (int) 60*fractional_hour;
725 double fractional_seconds = (60*fractional_hour - integer_minutes)*60;
729 ldate.
year = (short) year;
730 ldate.
day = (short) integer_days + 1;
731 ldate.
hour = (short) integer_hours;
732 ldate.
minute = (short) integer_minutes;
733 ldate.
second = fractional_seconds;
740 using namespace date;
741 using namespace std::chrono;
745 auto dp = sys_days(floor< date::days >(sys_tp));
748 year_month_day ymd{dp};
749 auto year_value = ymd.year();
751 auto ordinal_day = day_of_year(dp);
752 int integer_days = ordinal_day.count() - 1;
754 hh_mm_ss< std::chrono::nanoseconds > time{floor< std::chrono::nanoseconds >(sys_tp - dp)};
755 int ihours = time.hours().count();
756 int imins = time.minutes().count();
757 int isecs = time.seconds().count();
758 int inanos = time.subseconds().count();
761 floating_point_days = integer_days + frac_day;
767 double delta = (mjd - epoch_offset);
769 std::chrono::duration< double > duration_seconds(delta);
771 auto mjd_epoch_utc =
to_utc(mjd_epoch);
772 auto utc_time_point = mjd_epoch_utc + std::chrono::duration_cast< std::chrono::nanoseconds >(duration_seconds);
773 auto hops_time_point =
from_utc(utc_time_point);
774 return hops_time_point;
779 auto mjd_epoch_utc =
to_utc(mjd_epoch);
782 double delta = (tp_utc - mjd_epoch_utc).count();
785 delta += epoch_offset;
791 vex_date vdate = hops_clock::extract_vex_date(timestamp);
793 std::string vex_as_iso8601 = vex_date_to_iso8601_string(vdate);
799 using namespace date;
800 using namespace std::chrono;
804 auto dp = sys_days(floor< date::days >(sys_tp));
807 year_month_day ymd{dp};
808 auto year = ymd.year();
813 auto ordinal_day = day_of_year(dp);
816 hh_mm_ss< std::chrono::nanoseconds > time{floor< std::chrono::nanoseconds >(sys_tp - dp)};
817 auto hours = time.hours();
818 auto mins = time.minutes();
819 auto secs = time.seconds();
820 auto nanos = time.subseconds();
825 std::stringstream ss;
828 ss << std::setfill(
'0') << std::setw(3) << ordinal_day.count();
830 ss << std::setfill(
'0') << std::setw(2) << hours.count();
832 ss << std::setfill(
'0') << std::setw(2) << mins.count();
834 ss << std::setfill(
'0') << std::setw(2) << secs.count();
836 if(!truncate_to_nearest_second)
838 std::stringstream nss;
839 nss << std::setfill(
'0') << std::setw(9) << nanos.count();
840 std::string snano_sec;
842 std::string trimmed_nanosec = remove_trailing_zeros(snano_sec);
843 if(trimmed_nanosec.size() != 0)
846 ss << trimmed_nanosec;
856 using namespace date;
857 using namespace std::chrono;
861 auto dp = sys_days(floor< date::days >(sys_tp));
864 year_month_day ymd{dp};
865 auto year = ymd.year();
866 auto month = ymd.month();
867 auto day = ymd.day();
870 int iyear =
static_cast< int >(year);
871 unsigned int imonth =
static_cast< unsigned int >(month);
872 int epoch = (iyear % 100) * 2;
892 std::stringstream ss;
895 ss << std::setfill(
'0') << std::setw(2) << imonth;
897 ss << std::setfill('0') << std::setw(2) << static_cast< unsigned int >(day);
899 ss << std::setfill(
'0') << std::setw(2) << hours;
901 ss << std::setfill(
'0') << std::setw(2) << minutes;
903 ss << std::setfill(
'0') << std::setw(2) << integer_sec;
905 std::string epoch_iso8601 = ss.str();
907 int secs = std::chrono::duration_cast< std::chrono::seconds >(tp - epoch_tp).count();
915 using namespace date;
916 using namespace std::chrono;
918 int start_year = 2000;
919 int n_years = std::floor(vdif_epoch / 2);
920 int iyear = start_year + n_years;
922 std::cout <<
"n_years = " << n_years <<
" iyear = " << iyear << std::endl;
924 unsigned int imonth = 1;
925 if(vdif_epoch % 2 == 1)
929 unsigned int iday = 1;
936 std::stringstream ss;
939 ss << std::setfill(
'0') << std::setw(2) << imonth;
941 ss << std::setfill(
'0') << std::setw(2) << iday;
943 ss << std::setfill(
'0') << std::setw(2) << hours;
945 ss << std::setfill(
'0') << std::setw(2) << minutes;
947 ss << std::setfill(
'0') << std::setw(2) << integer_sec;
949 std::string epoch_iso8601 = ss.str();
950 std::cout <<
"epoch = " << epoch_iso8601 << std::endl;
952 auto tp = epoch_tp + std::chrono::seconds(vdif_seconds);
956 inline hops_clock::vex_date hops_clock::extract_vex_date(
const std::string& timestamp)
959 if(timestamp.size() == 0)
961 msg_error(
"utilities",
"cannot extract vex date from empty string." << eom);
965 MHO_Tokenizer tokenizer;
966 std::vector< std::string >
tokens;
967 std::stringstream ss;
969 std::string syear, sord_day, shour, smin, ssec;
971 tokenizer.SetDelimiter(std::string(
"y"));
972 tokenizer.SetString(×tamp);
973 tokenizer.GetTokens(&
tokens);
980 tokenizer.SetDelimiter(std::string(
"d"));
981 tokenizer.SetString(&rest);
982 tokenizer.GetTokens(&
tokens);
985 ss.str(std::string());
988 ss >> vdate.day_of_year;
991 tokenizer.SetDelimiter(std::string(
"h"));
992 tokenizer.SetString(&rest);
993 tokenizer.GetTokens(&
tokens);
996 ss.str(std::string());
1002 tokenizer.SetDelimiter(std::string(
"m"));
1003 tokenizer.SetString(&rest);
1004 tokenizer.GetTokens(&
tokens);
1007 ss.str(std::string());
1010 ss >> vdate.minutes;
1013 tokenizer.SetDelimiter(std::string(
"s"));
1014 tokenizer.SetString(&rest);
1015 tokenizer.GetTokens(&
tokens);
1018 ss.str(std::string());
1020 ss << std::setprecision(15) << ssec;
1021 ss >> vdate.seconds;
1026 inline std::string hops_clock::vex_date_to_iso8601_string(hops_clock::vex_date vdate)
1028 using namespace date;
1029 using namespace std::chrono;
1031 std::stringstream ss;
1036 date::days ord_day(vdate.day_of_year);
1037 date::sys_days ymd = get_year_month_day(y, ord_day);
1040 auto month = date::year_month_day{ymd}.month();
1041 auto mday = date::year_month_day{ymd}.day();
1042 ss << std::setfill(
'0') << std::setw(2) << (unsigned)month;
1044 ss << std::setfill(
'0') << std::setw(2) << (unsigned)mday;
1047 ss << std::setfill(
'0') << std::setw(2) << vdate.hours;
1049 ss << std::setfill(
'0') << std::setw(2) << vdate.minutes;
1055 double frac = modf(vdate.seconds, &intpart);
1056 int integer_sec = intpart;
1058 ss << std::setfill(
'0') << std::setw(2) << integer_sec;
1062 std::stringstream nss;
1063 nss << integer_nanosec;
1064 std::string nanoseconds_value = nss.str();
1065 std::string trimmed_int_nanosec = remove_trailing_zeros(nanoseconds_value);
1066 if(trimmed_int_nanosec.size() != 0)
1069 ss << trimmed_int_nanosec;
1075 inline hops_clock::vex_date hops_clock::vex_date_from_legacy(
const legacy_hops_date& legacy_date)
1077 hops_clock::vex_date vdate;
1078 vdate.year = legacy_date.year;
1079 vdate.day_of_year = legacy_date.day;
1080 vdate.hours = legacy_date.hour;
1081 vdate.minutes = legacy_date.minute;
1082 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:244
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:303
static time_point get_hops_epoch()
returns the hops_clock epoch as a hops_clock time_point
Definition: MHO_Clock.hh:317
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:854
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:502
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 double to_mjd(const time_point &mjd_epoch, const 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:777
static std::string to_iso8601_format(const time_point &tp)
Converts a time_point to ISO8601 formatted string.
Definition: MHO_Clock.hh:617
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:718
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:630
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:599
duration::rep rep
Definition: MHO_Clock.hh:46
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:913
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:797
static std::string to_hops_format(const time_point &tp)
Converts a time_point to HOPS format string.
Definition: MHO_Clock.hh:664
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:789
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:322
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:682
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:738
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:675
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 time_point from_mjd(const time_point &mjd_epoch, const double &epoch_offset, const double &mjd)
Converts a Modified Julian date (floating point epoch and day) timestamp to a hops_clock time_point.
Definition: MHO_Clock.hh:765
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_ChannelLabeler.hh:17
std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, const hops_time< Duration > &t)
Definition: MHO_Clock.hh:587
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:576
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:386
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:553
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