Use asctime_r for thread safety instead asctime 06/68406/2 accepted/tizen/common/20160504.130804 accepted/tizen/ivi/20160504.115159 accepted/tizen/mobile/20160504.114847 accepted/tizen/tv/20160504.114632 accepted/tizen/wearable/20160504.115004 submit/tizen/20160504.054436
authorsangwan.kwon <sangwan.kwon@samsung.com>
Wed, 4 May 2016 05:08:59 +0000 (14:08 +0900)
committersangwan.kwon <sangwan.kwon@samsung.com>
Wed, 4 May 2016 05:40:57 +0000 (14:40 +0900)
Change-Id: I714f19937f295930385622af3f3576f228fce1d2

vcore/vcore/TimeConversion.cpp

index ad0cf38..65f7d07 100644 (file)
@@ -286,8 +286,8 @@ int asn1TimeToTimeT(ASN1_TIME *t, time_t *res)
     if (ret == 0)
         return 0;
 
-    LogDebug("Convert asn1 to struct tm : "
-        << tm.tm_year + 1900 <<  tm.tm_mon + 1 << tm.tm_mday);
+    char buf[27]; // asctime_r return 26 characters
+    LogDebug("Convert asn1 to tm: " << asctime_r(&tm, buf));
     *res = mktime(&tm);
 
     // If time_t occured overflow, set TIME_MAX.
@@ -296,7 +296,7 @@ int asn1TimeToTimeT(ASN1_TIME *t, time_t *res)
         *res = TIME_MAX;
     }
 
-    LogDebug("Convert struct tm to time_t : " << asctime(gmtime(res)));
+    LogDebug("Result time_t(tm format): " << asctime_r(localtime(res), buf));
 
     return 1;
 }