get timezone from readlink in place of internal storage 71/80271/1 accepted/tizen/common/20160715.175645 accepted/tizen/ivi/20160717.035021 accepted/tizen/mobile/20160717.035010 accepted/tizen/tv/20160717.034901 accepted/tizen/wearable/20160717.034909 submit/tizen/20160715.114829 submit/tizen/20160715.114922
authorMyoungJune Park <mj2004.park@samsung.com>
Fri, 15 Jul 2016 11:37:55 +0000 (20:37 +0900)
committerMyoungJune Park <mj2004.park@samsung.com>
Fri, 15 Jul 2016 11:37:55 +0000 (20:37 +0900)
Change-Id: Ibd422ad3b47c545a8a48c7359c825327d56b2cd4

src/system_setting_platform.c

index 34b7258937709553c2290c5167608e3ffd450501..c4faeec6ef00ad8bd17bc9e0f899424ec98ad453 100644 (file)
@@ -1328,8 +1328,17 @@ int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settin
 
 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
 {
-       SETTING_TRACE_BEGIN;
-       *value = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
+       char tzpath[256];
+       ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath)-1);
+       if (len != -1) {
+               tzpath[len] = '\0';
+       } else {
+               SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       SETTING_TRACE("tzpath : %s ", &tzpath[20]);
+       *value = strdup(&tzpath[20]);
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
@@ -1337,17 +1346,17 @@ int system_setting_get_locale_timezone(system_settings_key_e key, system_setting
 int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
 {
        SETTING_TRACE_BEGIN;
-       char *vconf_value = NULL;
-       vconf_value = (char *)value;
+       char *timezone_value = NULL;
+       timezone_value = (char *)value;
 
        char tz_path[1024];
-       snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", vconf_value);
+       snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", timezone_value);
 
        int is_load = _is_file_accessible(tz_path);
        if (is_load == 0) {
                alarmmgr_set_timezone(tz_path);
 
-               if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, vconf_value)) {
+               if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, timezone_value)) {
                        return SYSTEM_SETTINGS_ERROR_IO_ERROR;
                }
                return SYSTEM_SETTINGS_ERROR_NONE;