Fix PLM P130828-03861 for system time zone.
authorHokwon Song <hokwon.song@samsung.com>
Mon, 2 Sep 2013 03:11:46 +0000 (12:11 +0900)
committerHokwon Song <hokwon.song@samsung.com>
Mon, 2 Sep 2013 03:11:46 +0000 (12:11 +0900)
Change-Id: I429acc30c51280c7d4341ae0f55aaaecc353749c
Signed-off-by: Hokwon Song <hokwon.song@samsung.com>
src/locales/FLcl_LocaleManagerImpl.cpp

index ead59d4..27ea0ca 100644 (file)
@@ -714,9 +714,22 @@ _LocaleManagerImpl::GetAvailableTimeZonesN(int rawOffset)
 TimeZone
 _LocaleManagerImpl::GetSystemTimeZone(void)
 {
-       std::unique_ptr< char, FreeCharPtr> tzId(vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID));
-       SysTryReturn(NID_LCL, tzId, TimeZone(-1, ""), E_SYSTEM, "It is failed to get System Time Zone.");
-       SysLog(NID_LCL, "System TimeZone id [%s]", tzId.get());
+       char pTZPath[256] = {0,};
+       char* pTZID = null;
+       bool isDeleted = false;
+       ssize_t nLen = readlink("/opt/etc/localtime", pTZPath, sizeof(pTZPath)-1);
+
+       if (nLen > 20)
+       {
+               pTZPath[nLen] = '\0';
+               pTZID = &pTZPath[20];
+       }
+       else
+       {
+               pTZID = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
+               SysTryReturn(NID_LCL, pTZID, TimeZone(-1, ""), E_SYSTEM, "It is failed to get System Time Zone.");
+               isDeleted = true;
+       }
 
        TimeZone timeZone;
        DateTime utcTime;
@@ -729,7 +742,11 @@ _LocaleManagerImpl::GetSystemTimeZone(void)
 
        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);
+       result r = Tizen::Locales::TimeZone::GetTimeZone(String(pTZID), utcTime, timeZone);
+       if (isDeleted)
+       {
+               delete pTZID;
+       }
        SysTryReturn(NID_LCL, r == E_SUCCESS, TimeZone(-1, ""), r, "[%s] error occurs.", GetErrorMessage(r));
        return timeZone;
 }