Add a watch_time_get_dst_status API 35/118535/5
authorSunwook Bae <sunwook45.bae@samsung.com>
Mon, 8 Jun 2015 05:12:42 +0000 (14:12 +0900)
committerSemun Lee <semun.lee@samsung.com>
Thu, 23 Mar 2017 02:29:01 +0000 (11:29 +0900)
Change-Id: Ib067a2fa006990e6c3659fdf33af684e070d51bb
Signed-off-by: Sunwook Bae <sunwook45.bae@samsung.com>
Signed-off-by: Semun Lee <semun.lee@samsung.com>
include/watch_app.h
src/watch_app_main.c

index 824d882..0fd894d 100755 (executable)
@@ -262,8 +262,8 @@ typedef enum {
  * @param[in] type The resolution type
  * @return 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @see watch_app_time_tick_resolution_e
  * @see watch_app_get_time_tick_frequency()
  */
@@ -276,8 +276,8 @@ int watch_app_set_time_tick_frequency(int ticks, watch_app_time_tick_resolution_
  * @param[out] type The resolution type
  * @return @c 0 on success,
            otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @see watch_app_time_tick_resolution_e
  * @see watch_app_set_time_tick_frequency()
  */
@@ -355,8 +355,8 @@ typedef enum {
  * @param[in] type The type of periodic ambient tick
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @see watch_app_ambient_tick_cb()
  */
 int watch_app_set_ambient_tick_type(watch_app_ambient_tick_type_e type);
@@ -367,8 +367,8 @@ int watch_app_set_ambient_tick_type(watch_app_ambient_tick_type_e type);
  * @remarks If you do not set specific tick type with watch_app_set_ambient_tick_type(), this function will set @a type to #WATCH_APP_AMBIENT_TICK_EVERY_MINUTE. * @param[out] type The type of periodic ambient tick
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @see watch_app_ambient_tick_cb()
  * @see watch_app_set_ambient_tick_type()
  */
@@ -381,9 +381,9 @@ int watch_app_get_ambient_tick_type(watch_app_ambient_tick_type_e *type);
  * @param[out] watch_time The watch_time handle to be newly created on successl
  * @return @c 0 on success,
  *         otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
  * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_OUT_OF_MEMORY Out of Memory
- * @retval #APP_ERROR_NONE Successful
  */
 int watch_time_get_current_time(watch_time_h *watch_time);
 
@@ -394,8 +394,8 @@ int watch_time_get_current_time(watch_time_h *watch_time);
  * @param[in] watch_time The watch_time handle
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_delete(watch_time_h watch_time);
 
@@ -407,8 +407,8 @@ int watch_time_delete(watch_time_h watch_time);
  * @param[out] year The year info
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_get_year(watch_time_h watch_time, int *year);
 
@@ -420,8 +420,8 @@ int watch_time_get_year(watch_time_h watch_time, int *year);
  * @param[out] month The month info
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_get_month(watch_time_h watch_time, int *month);
 
@@ -433,8 +433,8 @@ int watch_time_get_month(watch_time_h watch_time, int *month);
  * @param[out] day The day info
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_get_day(watch_time_h watch_time, int *day);
 
@@ -446,8 +446,8 @@ int watch_time_get_day(watch_time_h watch_time, int *day);
  * @param[out] day_of_week The day of week info. The value returns from 1 (Sunday) to 7 (Saturday).
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_get_day_of_week(watch_time_h watch_time, int *day_of_week);
 
@@ -459,8 +459,8 @@ int watch_time_get_day_of_week(watch_time_h watch_time, int *day_of_week);
  * @param[out] hour The hour info
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_get_hour(watch_time_h watch_time, int *hour);
 
@@ -472,8 +472,8 @@ int watch_time_get_hour(watch_time_h watch_time, int *hour);
  * @param[out] hour24 The hour info
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_get_hour24(watch_time_h watch_time, int *hour24);
 
@@ -485,8 +485,8 @@ int watch_time_get_hour24(watch_time_h watch_time, int *hour24);
  * @param[out] minute The minute info
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_get_minute(watch_time_h watch_time, int *minute);
 
@@ -498,8 +498,8 @@ int watch_time_get_minute(watch_time_h watch_time, int *minute);
  * @param[out] second The second info
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_get_second(watch_time_h watch_time, int *second);
 
@@ -511,8 +511,8 @@ int watch_time_get_second(watch_time_h watch_time, int *second);
  * @param[out] millisecond The millisecond info
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_get_millisecond(watch_time_h watch_time, int *millisecond);
 
@@ -524,8 +524,8 @@ int watch_time_get_millisecond(watch_time_h watch_time, int *millisecond);
  * @param[out] utc_time The UTC time
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_get_utc_time(watch_time_h watch_time, struct tm *utc_time);
 
@@ -535,10 +535,10 @@ int watch_time_get_utc_time(watch_time_h watch_time, struct tm *utc_time);
  * @since_tizen 2.3.1
  * @param[in] watch_time The watch_time handle
  * @param[out] utc_timestamp The UTC timestamp
- * @return @c 0 on success, 
+ * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_get_utc_timestamp(watch_time_h watch_time, time_t *utc_timestamp);
 
@@ -551,13 +551,25 @@ int watch_time_get_utc_timestamp(watch_time_h watch_time, time_t *utc_timestamp)
  * @param[out] time_zone_id The Timezone ID, such as "America/Los_Angeles"
  * @return @c 0 on success,
  *         otherwise a negative error value
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
  */
 int watch_time_get_time_zone(watch_time_h watch_time, char **time_zone_id);
 
 
 /**
+ * @brief Gets the daylight saving time status.
+ * @since_tizen 4.0
+ * @param[in] watch_time The watch_time handle
+ * @param[out] status The daylight saving time status;
+                      @c true if DST is in effect, @c false otherwise
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid Parameter
+ */
+int watch_time_get_dst_status(watch_time_h watch_time, bool *status);
+
+/**
  * @}
  */
 
index ec85193..f619c00 100755 (executable)
@@ -84,6 +84,7 @@ struct _watch_time_s {
        int minute;
        int second;
        int millisecond;
+       int indaylight;
        time_t timestamp;
        char *timezone;
 };
@@ -214,6 +215,7 @@ static void __get_timeinfo(struct _watch_time_s *timeinfo)
        timeinfo->minute = ucal_get(cal, UCAL_MINUTE, &status);
        timeinfo->second = ucal_get(cal, UCAL_SECOND, &status);
        timeinfo->millisecond = ucal_get(cal, UCAL_MILLISECOND, &status);
+       timeinfo->indaylight = ucal_inDaylightTime(cal, &status);
        timeinfo->timezone = timezone;
 
        timeinfo->hour -= (timeinfo->hour > 12) ? 12 : 0;
@@ -906,6 +908,19 @@ EXPORT_API int watch_time_get_time_zone(watch_time_h watch_time,
        return APP_ERROR_NONE;
 }
 
+EXPORT_API int watch_time_get_dst_status(watch_time_h watch_time, bool *status)
+{
+       if (watch_time == NULL)
+               return watch_app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+       if (watch_time->indaylight)
+               *status = true;
+       else
+               *status = false;
+
+       return APP_ERROR_NONE;
+}
+
 EXPORT_API int watch_app_get_elm_win(Evas_Object **win)
 {
        Evas_Object *ret_win;