Merge commit 'refs/pull/1853/head' of github.com:znc/znc

This commit is contained in:
Alexey Sokolov
2023-01-07 20:41:48 +00:00
2 changed files with 36 additions and 0 deletions

View File

@@ -109,6 +109,27 @@ TEST(UtilsTest, ServerTime) {
CString str3 = CUtils::FormatServerTime(tv3);
EXPECT_EQ(str3, "1970-01-01T00:00:00.000Z");
if (oldTZ) {
setenv("TZ", oldTZ, 1);
free(oldTZ);
} else {
unsetenv("TZ");
}
tzset();
}
TEST(UtilsTest, ParseServerTime) {
char* oldTZ = getenv("TZ");
if (oldTZ) oldTZ = strdup(oldTZ);
setenv("TZ", "America/Montreal", 1);
tzset();
timeval tv4 = CUtils::ParseServerTime("2011-10-19T16:40:51.620Z");
CString str4 = CUtils::FormatServerTime(tv4);
EXPECT_EQ(str4, "2011-10-19T16:40:51.620Z");
if (oldTZ) {
setenv("TZ", oldTZ, 1);
free(oldTZ);