//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// http://www.boost.org/doc/libs/1_44_0/libs/test/doc/html/utf/testing-tools/reference.html
BOOST_AUTO_TEST_CASE(date) {
// http://www.boost.org/doc/libs/1_44_0/libs/test/doc/html/utf/testing-tools/reference.html
BOOST_AUTO_TEST_CASE(date) {
anna::time::functions::initialize();
anna::time::Date current, current2;
anna::time::functions::initialize();
anna::time::Date current, current2;
unsigned int ntptime = current.getNtpTimestamp();
time_t unixtime = current.getUnixTimestamp();
current2.storeNtp(ntptime);
std::string ntpStr = current2.asString();
current2.storeUnix(unixtime);
std::string unixStr = current2.asString();
unsigned int ntptime = current.getNtpTimestamp();
time_t unixtime = current.getUnixTimestamp();
current2.storeNtp(ntptime);
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)
BOOST_REQUIRE_EQUAL(ntpStr, unixStr);
anna::time::Date myBirth("CET"); // 19 December 1974, 10:00 (GMT+1 = UTC + 1 = CET)
anna::time::Date same_moment_canary_island("GMT");
same_moment_canary_island.store(myBirth.getUnixTimestamp());
anna::time::Date same_moment_canary_island("GMT");
same_moment_canary_island.store(myBirth.getUnixTimestamp());
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(same_moment_canary_island.yyyymmddHHmmss(), myBirth.yyyymmddHHmmss());
anna::time::Date birthday("EET");
birthday.store(same_moment_canary_island.getTm(), "GMT"); // TZ origin = "GMT"