void testToLocalTime() { const vmime::datetime date (2005, 12, 2, 12, 34, 56, -120); // GMT-2 const vmime::datetime local = datetimeUtils::toLocalTime(date, 120); // GMT+2 VASSERT_EQ("1", 2005, local.getYear()); VASSERT_EQ("2", 12, local.getMonth()); VASSERT_EQ("3", 2, local.getDay()); VASSERT_EQ("4", 16, local.getHour()); VASSERT_EQ("5", 34, local.getMinute()); VASSERT_EQ("6", 56, local.getSecond()); VASSERT_EQ("7", 120, local.getZone()); }
void testToUniversalTime() { const vmime::datetime local (2005, 12, 2, 12, 34, 56, -789); const vmime::datetime gmt = datetimeUtils::toUniversalTime(local); // 789 is 13 hours, 9 minutes later VASSERT_EQ("1", 2005, gmt.getYear()); VASSERT_EQ("2", 12, gmt.getMonth()); VASSERT_EQ("3", 3, gmt.getDay()); VASSERT_EQ("4", 1, gmt.getHour()); VASSERT_EQ("5", 43, gmt.getMinute()); VASSERT_EQ("6", 56, gmt.getSecond()); VASSERT_EQ("7", 0, gmt.getZone()); }