From 3a25e4e22df30c48a6e42c7870a4fba2386c6773 Mon Sep 17 00:00:00 2001 From: Jiwoong Im Date: Mon, 20 Mar 2017 17:54:57 +0900 Subject: [PATCH] Add extension APIs API list - alarm_set_systime - alarm_set_systime_with_propagation_delay - alarm_set_timezone Change-Id: Ia59f3538f37b7ca60cf7b3a0fd758be0f6a6d6c5 Signed-off-by: Jiwoong Im --- include/app_alarm_extension.h | 45 +++++++++++++++++++++++++++++++++++++++++++ src/alarm.c | 33 +++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/include/app_alarm_extension.h b/include/app_alarm_extension.h index b9abadf..2ea34e0 100644 --- a/include/app_alarm_extension.h +++ b/include/app_alarm_extension.h @@ -96,6 +96,51 @@ int alarm_schedule_service_once_after_delay(app_control_h app_control, int delay int alarm_schedule_service_once_at_date(app_control_h app_control, struct tm *date, int *alarm_id); /** + * @brief Changes the system time which tranferred by other module + * @since_tizen 3.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/systemsettings.admin + * + * @param[in] new_time epoch time to be set + * @return @c 0 on success, + * otherwise a negative error value + * @retval #ALARM_ERROR_NONE Successful + * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server + */ +int alarm_set_systime(int new_time); + +/** + * @brief Changes the system time and compensates the time using propagation delay + * @since_tizen 3.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/systemsettings.admin + * + * @param[in] new_time system time to be set (seconds, nanoseconds) + * @param[in] req_time time to request to change the system time (seconds, nanoseconds) + * @return @c 0 on success, + * otherwise a negative error value + * @retval #ALARM_ERROR_NONE Successful + * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server + */ +int alarm_set_systime_with_propagation_delay(struct timespec new_time, struct timespec req_time); + +/** + * @brief Changes the timezone which tranferred by other module + * @since_tizen 3.0 + * @privlevel platform + * @privilege %http://tizen.org/privilege/systemsettings.admin + * + * @param[in] tzpath_str the path to timezone definition file + * @return @c 0 on success, + * otherwise a negative error value + * @retval #ALARM_ERROR_NONE Successful + * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server + */ +int alarm_set_timezone(char *tzpath_str); + +/** * @} */ diff --git a/src/alarm.c b/src/alarm.c index b3d97ef..a4327c2 100755 --- a/src/alarm.c +++ b/src/alarm.c @@ -911,3 +911,36 @@ int alarm_update_week_flag(int alarm_id, int week_flag) return convert_error_code_to_alarm(__FUNCTION__, result); } + +int alarm_set_systime(int new_time) +{ + int result; + + result = alarmmgr_set_systime(new_time); + if (result < 0) + return convert_error_code_to_alarm(__FUNCTION__, result); + + return ALARM_ERROR_NONE; +} + +int alarm_set_systime_with_propagation_delay(struct timespec new_time, struct timespec req_time) +{ + int result; + + result = alarmmgr_set_systime_with_propagation_delay(new_time, req_time); + if (result < 0) + return convert_error_code_to_alarm(__FUNCTION__, result); + + return ALARM_ERROR_NONE; +} + +int alarm_set_timezone(char *tzpath_str) +{ + int result; + + result = alarmmgr_set_timezone(tzpath_str); + if (result < 0) + return convert_error_code_to_alarm(__FUNCTION__, result); + + return ALARM_ERROR_NONE; +} -- 2.7.4