From: Radoslaw Czerski Date: Mon, 18 Jul 2016 11:39:18 +0000 (+0200) Subject: [HOTFIX][TSAM-6502] Wrong time fix. X-Git-Tag: submit/tizen/20160718.153454^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe04edab6b7067545dd362575fec0a48ad801030;p=profile%2Fmobile%2Fapps%2Fnative%2Findicator.git [HOTFIX][TSAM-6502] Wrong time fix. Change-Id: Ief0763c464eb74af98ab0701d24dff03e89bf227 Signed-off-by: Radoslaw Czerski --- diff --git a/inc/util.h b/inc/util.h index 6cc1ce8..0f7c17b 100644 --- a/inc/util.h +++ b/inc/util.h @@ -181,9 +181,9 @@ extern int util_check_system_status(void); /** * @brief Gets timezone from vconf. * - * @return timezone id or "N/A" on failure + * @param[in/out] timezone id or "N/A" on failure */ -extern char *util_get_timezone_str(void); +extern void util_get_timezone_str(char **timezone); /** * @brief Gets window angle property. diff --git a/src/modules/clock/clock.c b/src/modules/clock/clock.c index c44babc..5f590ca 100644 --- a/src/modules/clock/clock.c +++ b/src/modules/clock/clock.c @@ -271,24 +271,22 @@ static void clock_format_changed(void *data) retm_if(ret != SYSTEM_SETTINGS_ERROR_NONE, "Error getting time format value"); /* Check Time format. If timeformat have invalid value, Set to 12H */ - if (mode_24) - { - if(clock_mode == INDICATOR_CLOCK_MODE_12H) - { + if (mode_24) { + if(clock_mode == INDICATOR_CLOCK_MODE_12H) { clock_mode = INDICATOR_CLOCK_MODE_24H; box_update_display(&(ad->win)); } } - else - { - if(clock_mode==INDICATOR_CLOCK_MODE_24H) - { + else { + if(clock_mode == INDICATOR_CLOCK_MODE_24H) { clock_mode = INDICATOR_CLOCK_MODE_12H; box_update_display(&(ad->win)); } } - char *timezone_str = util_get_timezone_str(); + char *timezone_str = NULL; + util_get_timezone_str(&timezone_str); + ret_if(!timezone_str); ret = i18n_timezone_create(&timezone, timezone_str); if (ret != I18N_ERROR_NONE) { @@ -468,7 +466,8 @@ void indicator_get_apm_by_region(char* output,void *data) i18n_ustring_copy_au(s_best_pattern, u_best_pattern); i18n_ustring_copy_ua(u_best_pattern, "a"); - char *timezone_id = util_get_timezone_str(); + char *timezone_id = NULL; + util_get_timezone_str(&timezone_id); _D("TimeZone is %s", timezone_id); if (s_best_pattern[0] == 'a') { @@ -602,7 +601,9 @@ void indicator_get_time_by_region(char* output,void *data) return; } - char* timezone_id = util_get_timezone_str(); + char *timezone_id = NULL; + util_get_timezone_str(&timezone_id); + _D("TimeZone is %s", timezone_id); if (timezone_id) { diff --git a/src/util.c b/src/util.c index f4e9443..c9d809c 100644 --- a/src/util.c +++ b/src/util.c @@ -430,24 +430,13 @@ void util_icon_access_unregister(icon_s *icon) -static char* _get_timezone_from_vconf(void) +void util_get_timezone_str(char **timezone) { - char *szTimezone = NULL; - szTimezone = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID); - if(szTimezone == NULL) - { - _E("Cannot get time zone."); - return strdup("N/A"); + int ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, timezone); + if (ret != SYSTEM_SETTINGS_ERROR_NONE) { + _E("system_settings_get_value_string failed: %s", get_error_message(ret)); + *timezone = "N/A"; } - - return szTimezone; -} - - - -char* util_get_timezone_str(void) -{ - return _get_timezone_from_vconf(); }