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/src/zlib_file.cpp b/src/zlib_file.cpp
index 042dafb..73695b0 100644
--- a/src/zlib_file.cpp
+++ b/src/zlib_file.cpp
@@ -41,9 +41,17 @@
 {
     int rc;
 
-    // Write time stamp
-    rc = gzprintf(fd, "[ %02i:%02i:%02i ] ", timeStamp.tm_hour,
-                  timeStamp.tm_min, timeStamp.tm_sec);
+    // Write time stamp.
+    // "tm_gmtoff" is the number of seconds east of UTC, so we need to calculate
+    // timezone offset. For example, for U.S. Eastern Standard Time, the value
+    // is -18000 = -5*60*60."
+
+    rc = gzprintf(fd, "[ %i-%02i-%02iT%02i:%02i:%02i%+03ld:%02ld ] ",
+                  timeStamp.tm_year + 1900, timeStamp.tm_mon + 1,
+                  timeStamp.tm_mday, timeStamp.tm_hour, timeStamp.tm_min,
+                  timeStamp.tm_sec, timeStamp.tm_gmtoff / (60 * 60),
+                  abs(timeStamp.tm_gmtoff % (60 * 60)) / 60);
+
     if (rc <= 0)
     {
         throw ZlibException(ZlibException::write, rc, fd, fileName);