Replace gmtime to gmtime_r for TimeZone
authorHokwon Song <hokwon.song@samsung.com>
Mon, 19 Aug 2013 01:48:19 +0000 (10:48 +0900)
committerHokwon Song <hokwon.song@samsung.com>
Mon, 19 Aug 2013 01:48:19 +0000 (10:48 +0900)
Change-Id: I1e9f744f0769510d137da13e5a47fed1b5525afa
Signed-off-by: Hokwon Song <hokwon.song@samsung.com>
src/locales/FLcl_LocaleManagerImpl.cpp

index c0b4764..ead59d4 100644 (file)
@@ -720,14 +720,14 @@ _LocaleManagerImpl::GetSystemTimeZone(void)
 
        TimeZone timeZone;
        DateTime utcTime;
-       struct tm* pGmTime = null;
-       time_t currTime = 0;
-       time(&currTime);
-       SysTryReturn(NID_LCL, currTime, TimeZone(-1, ""), E_SYSTEM, "It is failed to get system time.");
-       pGmTime = gmtime(&currTime);
+       struct tm gmTime;
+       struct tm*  pGmTime = null;
+       time_t currTime = time(null);
+
+       pGmTime = gmtime_r(&currTime, &gmTime);
        SysTryReturn(NID_LCL, pGmTime, TimeZone(-1, ""), E_SYSTEM, "It is failed to convert the time value to UTC time.");
 
-       utcTime.SetValue(pGmTime->tm_year + 1900, pGmTime->tm_mon + 1, pGmTime->tm_mday, pGmTime->tm_hour, pGmTime->tm_min, pGmTime->tm_sec);
+       utcTime.SetValue(gmTime.tm_year + 1900, gmTime.tm_mon + 1, gmTime.tm_mday, gmTime.tm_hour, gmTime.tm_min, gmTime.tm_sec);
 
        result r = Tizen::Locales::TimeZone::GetTimeZone(String(tzId.get()), utcTime, timeZone);
        SysTryReturn(NID_LCL, r == E_SUCCESS, TimeZone(-1, ""), r, "[%s] error occurs.", GetErrorMessage(r));