From a4d74dbf973359e4e853539344e036c8ae97e0d6 Mon Sep 17 00:00:00 2001 From: MyoungJune Park Date: Fri, 15 Jul 2016 20:37:55 +0900 Subject: [PATCH] get timezone from readlink in place of internal storage Change-Id: Ibd422ad3b47c545a8a48c7359c825327d56b2cd4 --- src/system_setting_platform.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/system_setting_platform.c b/src/system_setting_platform.c index 34b7258..c4faeec 100644 --- a/src/system_setting_platform.c +++ b/src/system_setting_platform.c @@ -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; -- 2.7.4