Add extension APIs 96/164996/1
authorJiwoong Im <jiwoong.im@samsung.com>
Mon, 20 Mar 2017 08:54:57 +0000 (17:54 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 22 Dec 2017 08:00:42 +0000 (17:00 +0900)
API list
 - alarm_set_systime
 - alarm_set_systime_with_propagation_delay
 - alarm_set_timezone

Change-Id: Ia59f3538f37b7ca60cf7b3a0fd758be0f6a6d6c5
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
include/app_alarm_extension.h
src/alarm.c

index b9abadf..2ea34e0 100644 (file)
@@ -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);
+
+/**
  * @}
  */
 
index b3d97ef..a4327c2 100755 (executable)
@@ -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;
+}