std::string ntpStr = current2.asString();
current2.storeUnix(unixtime);
std::string unixStr = current2.asString();
-
BOOST_REQUIRE_EQUAL(ntpStr, unixStr);
-
anna::time::Date myBirth("CET"); // 19 December 1974, 10:00 (GMT+1 = UTC + 1 = CET)
//anna::time::Date myBirth; // if Context TZ = shell TZ = "CET"
myBirth.store("19741219101500"); // yyyymmddHHmmss
-
anna::time::Date same_moment_canary_island("GMT");
same_moment_canary_island.store(myBirth.getUnixTimestamp());
myBirth.setTzContext("GMT");
BOOST_REQUIRE_EQUAL(same_moment_canary_island.yyyymmddHHmmss(), myBirth.yyyymmddHHmmss());
-
anna::time::Date birthday("EET");
birthday.store(same_moment_canary_island.getTm(), "GMT"); // TZ origin = "GMT"
//BOOST_REQUIRE_EQUAL(birthday, myBirth);
BOOST_REQUIRE_EQUAL(birthday.getUnixTimestamp(), myBirth.getUnixTimestamp());
-
myBirth.setTzContext(anna::time::functions::getLocalTz().getValue().c_str());
birthday.setTzContext(anna::time::functions::getLocalTz().getValue().c_str()); // Go from "EET" to "CET"
BOOST_REQUIRE_EQUAL(myBirth.yyyymmddHHmmss(), birthday.yyyymmddHHmmss());
-
// Adding 18 years to 'myBirth':
struct tm Tm = myBirth.getTm();
Tm.tm_year += 18;