#ifdef _USE_GTEST #include "full_test_adsb.h" #include "test_c_common.h" #include "test_bds_inference.h" #include "test_adsb.h" #include "test_allcall.h" #include "test_tell.h" #include "test_surv.h" #include "test_mode_a_c.h" TEST(MLAT, timestamp_build) { // Timestamp of 1019UTC: 0x244bbb9ac9f0 // lower 30 bits are 0x3b9ac9f0 => Nanosecond = 999999984 * 1e-9 // upper 18 bits are 0x912e => daysec = 37166 // hour = 37166/3600 = 10 // minute = 37166 / 60 modulo 60 = 19 // second = 37166 modulo 60 = 26 // So time is 10:19:26.999999984 after UTC midnight std::vector list; list.emplace_back(37166, 999999984); list.emplace_back(Psc::hex2mem(std::string("244BBB9AC9F0"))); for (auto &t : list) { auto it = bin2hex(t.to_bin_string()); EXPECT_STREQ(it.c_str(), "244BBB9AC9F0"); EXPECT_EQ(t.daysec, 37166); EXPECT_EQ(t.nanosec, 999999984); EXPECT_EQ(t.hh, 10); EXPECT_EQ(t.mm, 19); EXPECT_EQ(t.ss, 26); } MLAT_timestamp t; // std::cout << t.toJson().toJsonString() << std::endl; } //int main(int argc, char **argv) { // ::testing::InitGoogleTest(&argc, argv); // return RUN_ALL_TESTS(); //} #endif