CUtils::ParseServerTime(): fix handling of invalid timestamps

This commit is contained in:
J-P Nurmi
2015-09-18 01:16:01 +02:00
parent f1973fe81b
commit 683379df7d
2 changed files with 11 additions and 4 deletions
+4
View File
@@ -96,6 +96,10 @@ TEST(UtilsTest, ServerTime) {
EXPECT_EQ(now.tv_sec, tv2.tv_sec);
EXPECT_EQ(now.tv_usec, tv2.tv_usec);
timeval tv3 = CUtils::ParseServerTime("invalid");
CString str3 = CUtils::FormatServerTime(tv3);
EXPECT_EQ("1970-01-01T00:00:00.000Z", str3);
if (oldTZ) {
setenv("TZ", oldTZ, 1);
free(oldTZ);