This commit is contained in:
2025-03-19 17:31:03 +03:00
parent cf37281e0f
commit 2a838830c8
4 changed files with 168 additions and 342 deletions

View File

@@ -4,51 +4,6 @@
#include "../mount_astrom.h"
static std::string leap_secs_file = R"--(
# Value of TAI-UTC in second valid beetween the initial value until
# the epoch given on the next line. The last line reads that NO
# leap second was introduced since the corresponding date
# Updated through IERS Bulletin 69 issued in January 2025
#
#
# File expires on 28 December 2025
#
#
# MJD Date TAI-UTC (s)
# day month year
# --- -------------- ------
#
41317.0 1 1 1972 10
41499.0 1 7 1972 11
41683.0 1 1 1973 12
42048.0 1 1 1974 13
42413.0 1 1 1975 14
42778.0 1 1 1976 15
43144.0 1 1 1977 16
43509.0 1 1 1978 17
43874.0 1 1 1979 18
44239.0 1 1 1980 19
44786.0 1 7 1981 20
45151.0 1 7 1982 21
45516.0 1 7 1983 22
46247.0 1 7 1985 23
47161.0 1 1 1988 24
47892.0 1 1 1990 25
48257.0 1 1 1991 26
48804.0 1 7 1992 27
49169.0 1 7 1993 28
49534.0 1 7 1994 29
50083.0 1 1 1996 30
50630.0 1 7 1997 31
51179.0 1 1 1999 32
53736.0 1 1 2006 33
54832.0 1 1 2009 34
56109.0 1 7 2012 35
57204.0 1 7 2015 36
57754.0 1 1 2017 37
)--";
int main(int argc, char* argv[])
{
int ecode = 0;
@@ -64,37 +19,39 @@ int main(int argc, char* argv[])
exit(1);
}
auto db_a = mcc::astro::mcc_parse_bulletinA(ist);
if (db_a.state != mcc::astro::IERS_DB_STATE_OK) {
std::cout << "Cannot parse input IERS Bulletin A file!\n";
ecode = 1;
} else {
std::cout << "IERS Bulletin A data:\n";
std::cout << "Date: " << db_a.bulletinDate << "\n";
std::cout << "TT-TAI: " << db_a.tt_tai << "\n";
for (auto& el : db_a.db) {
std::cout << "MJD: " << el.mjd << "\tDUT1 = " << el.dut1 << "\n";
}
}
mcc::astrom::MccIersBulletinA bullA;
bullA.dump(std::cout);
std::cout << "\n\n";
mcc::astrom::MccLeapSeconds lps;
lps.dump(std::cout);
std::cout << "\n\n";
bool ok = bullA.load(ist);
bullA.dump(std::cerr);
ist.close();
std::cout << "\n\n\n";
std::cout << "\n\n\n------------------\n";
std::istringstream isst(leap_secs_file);
auto db_ls = mcc::astro::mcc_parse_leapsecs(isst);
auto now = std::chrono::system_clock::now();
std::cout << "LEAP SECS for now: " << lps[now].value_or(std::numeric_limits<double>::quiet_NaN()) << "\n";
std::cout << "DUT1 for now: " << bullA.DUT1(now).value_or(std::numeric_limits<double>::quiet_NaN()) << " (" << now
<< ")\n";
double mjd = 61077.4;
std::cout << "DUT1 for MJD = " << mjd << ": " << bullA.DUT1(mjd).value_or(std::numeric_limits<double>::quiet_NaN())
<< "\n";
auto st = mcc::astrom::mcc_julday(now, mjd);
std::cout << "MJD for now: " << std::setprecision(19) << mjd << " (" << now << ")\n";
if (db_ls.state != mcc::astro::IERS_DB_STATE_OK) {
std::cout << "Cannot parse input IERS leap seconds file!\n";
ecode = 1;
} else {
std::cout << "IERS leap seconds data:\n";
std::cout << "Expire date: " << db_ls.expireDate << "\n";
for (auto& el : db_ls.db) {
std::cout << "MJD: " << el.mjd << "\tTAI-UTC = " << el.tai_utc << "\n";
}
}
return ecode;
}