Modify Timestamp to RFC3339 Format
Modify host log timestamp to RFC3339 time format to provide more time information.
Origin sample message:
[ 00:00:31 ] >>> Log collection started at 1970-01-01 00:00:31
After modified, the message will be liked:
[ 1970-01-01T00:00:31+00:00 ] >>> Log collection started at 1970-01-01 00:00:31
Signed-off-by: SpencerKu <Spencer.Ku@quantatw.com>
Change-Id: Ief4c074523830d1ce1f90658085ce661c0220573
diff --git a/test/zlib_file_test.cpp b/test/zlib_file_test.cpp
index ef49a6f..65f2206 100644
--- a/test/zlib_file_test.cpp
+++ b/test/zlib_file_test.cpp
@@ -25,9 +25,13 @@
file.close();
char expect[64];
- const int len = snprintf(expect, sizeof(expect), "[ %02i:%02i:%02i ] %s\n",
- localTime.tm_hour, localTime.tm_min,
- localTime.tm_sec, msg.c_str());
+ const int len =
+ snprintf(expect, sizeof(expect),
+ "[ %i-%02i-%02iT%02i:%02i:%02i%+03ld:%02ld ] %s\n",
+ localTime.tm_year + 1900, localTime.tm_mon + 1,
+ localTime.tm_mday, localTime.tm_hour, localTime.tm_min,
+ localTime.tm_sec, localTime.tm_gmtoff / (60 * 60),
+ abs(localTime.tm_gmtoff % (60 * 60)) / 60, msg.c_str());
gzFile fd = gzopen(path.c_str(), "r");
ASSERT_TRUE(fd);