[Base-utils][Timezone] Detect host timezone function added. 26/95826/1 accepted/tizen/3.0/common/20161114.081804 accepted/tizen/3.0/ivi/20161108.002436 accepted/tizen/3.0/mobile/20161108.002328 accepted/tizen/3.0/tv/20161108.002354 accepted/tizen/3.0/wearable/20161108.002416 submit/tizen_3.0/20161107.014118 submit/tizen_3.0_common/20161110.084657
authorRafal Szczekutek <r.szczekutek@samsung.com>
Fri, 14 Oct 2016 11:01:00 +0000 (13:01 +0200)
committerhyunjee Kim <hj0426.kim@samsung.com>
Mon, 7 Nov 2016 01:37:40 +0000 (17:37 -0800)
Change-Id: I801c263a43c651ccd5d7ceeb9ba4b85f61b125dd
Signed-off-by: Tomasz Bochenski <t.bochenski@partner.samsung.com>
Signed-off-by: Tomasz Bochenski <t.bochenski@samsung.com>
Signed-off-by: Rafal Szczekutek <r.szczekutek@samsung.com>
Signed-off-by: Tomasz Bochenski <t.bochenski@samsung.com>
(cherry picked from commit 18e8b27f20503083b8be7c35aa15de02d0894a33)

src/include/cleaned/utils_i18n_timezone.h
src/include/deprecated/utils_i18n_timezone.h
src/include/utils_i18n.h
src/include/utils_i18n_timezone.h
src/include/utils_i18n_ucalendar.h
src/utils_i18n_timezone.cpp

index aa11fc827c6ed089bc354a5dc2ad836f618013b5..f8ddec07b3cad04ff81afbf9cdafb568a02eb8d9 100644 (file)
@@ -211,6 +211,9 @@ int i18n_timezone_get_equivalent_id(const char *timezone_id, int32_t index, char
  *
  * This function determines the default timezone by querying the system once and storing the
  * obtained timezone as default until the application terminates.
+ *
+ * To query the system for the current timezone, use i18n_timezone_detect_host_timezone().
+ *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
  * @param[out] timezone A default i18n_timezone_h. Clients are responsible for deleting the time zone object returned.
@@ -444,6 +447,22 @@ int i18n_timezone_clone(i18n_timezone_h timezone, i18n_timezone_h *clone);
  */
 int i18n_timezone_get_dst_savings(i18n_timezone_h timezone, int32_t *dst_savings);
 
+/**
+ * @brief Creates an #i18n_timezone_h detected from the current host system configuration.
+ * @details This function does not change the default time zone and does not update the current
+ * ICU's default. It may return a different #i18n_timezone_h from the one returned by
+ * i18n_timezone_create_default().
+ * @since_tizen 3.0
+ *
+ * @param[out] timezone A new instance of #i18n_timezone_h detected from the current host system
+ * configuration. Users are responsible for deleting the returned time zone object with
+ * i18n_timezone_destroy().
+ *
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_timezone_detect_host_timezone(i18n_timezone_h *timezone);
+
 #ifdef __cplusplus
 }
 #endif
index f18ecdefb338ae8474616afdeb0633a626be8d74..8f32becf5e1c8516baec6b6a7ef7d7bc1e03d4e1 100644 (file)
@@ -212,6 +212,9 @@ int i18n_timezone_get_equivalent_id(const char *timezone_id, int32_t index, char
  *
  * This function determines the default timezone by querying the system once and storing the
  * obtained timezone as default until the application terminates.
+ *
+ * To query the system for the current timezone, use i18n_timezone_detect_host_timezone().
+ *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
  * @param[out] timezone A default i18n_timezone_h. Clients are responsible for deleting the time zone object returned.
@@ -460,6 +463,22 @@ int i18n_timezone_clone(i18n_timezone_h timezone, i18n_timezone_h *clone);
  */
 int i18n_timezone_get_dst_savings(i18n_timezone_h timezone, int32_t *dst_savings);
 
+/**
+ * @brief Creates an #i18n_timezone_h detected from the current host system configuration.
+ * @details This function does not change the default time zone and does not update the current
+ * ICU's default. It may return a different #i18n_timezone_h from the one returned by
+ * i18n_timezone_create_default().
+ * @since_tizen 3.0
+ *
+ * @param[out] timezone A new instance of #i18n_timezone_h detected from the current host system
+ * configuration. Users are responsible for deleting the returned time zone object with
+ * i18n_timezone_destroy().
+ *
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_timezone_detect_host_timezone(i18n_timezone_h *timezone);
+
 #ifdef __cplusplus
 }
 #endif
index 037642325bd24104f47b2bebca79844e6208f06c..f152e7048587669360b29f2b87c73b887029f3d8 100644 (file)
@@ -350,6 +350,11 @@ extern "C" {
  *       <td>getDSTSavings</td>
  * </tr>
  * <tr>
+ *    <td>@ref CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE</td>
+ *    <td>#i18n_timezone_detect_host_timezone</td>
+ *    <td>detectHostTimeZone</td>
+ * </tr>
+ * <tr>
  *       <td>@ref CAPI_BASE_UTILS_I18N_UENUMERATION_MODULE</td>
  *       <td>#i18n_uenumeration_destroy</td>
  *       <td>uenum_close</td>
index ddedd740b7d203495b726551f6808abe26a0637a..09d3e7259e03a97428290532bfbb9e1cbeaa3e68 100644 (file)
@@ -211,6 +211,9 @@ int i18n_timezone_get_equivalent_id(const char *timezone_id, int32_t index, char
  *
  * This function determines the default timezone by querying the system once and storing the
  * obtained timezone as default until the application terminates.
+ *
+ * To query the system for the current timezone, use i18n_timezone_detect_host_timezone().
+ *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
  * @param[out] timezone A default i18n_timezone_h. Clients are responsible for deleting the time zone object returned.
@@ -459,6 +462,22 @@ int i18n_timezone_clone(i18n_timezone_h timezone, i18n_timezone_h *clone);
  */
 int i18n_timezone_get_dst_savings(i18n_timezone_h timezone, int32_t *dst_savings);
 
+/**
+ * @brief Creates an #i18n_timezone_h detected from the current host system configuration.
+ * @details This function does not change the default time zone and does not update the current
+ * ICU's default. It may return a different #i18n_timezone_h from the one returned by
+ * i18n_timezone_create_default().
+ * @since_tizen 3.0
+ *
+ * @param[out] timezone A new instance of #i18n_timezone_h detected from the current host system
+ * configuration. Users are responsible for deleting the returned time zone object with
+ * i18n_timezone_destroy().
+ *
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_timezone_detect_host_timezone(i18n_timezone_h *timezone);
+
 #ifdef __cplusplus
 }
 #endif
index 181eb185bd15213ef838516fabaaf97c0e15cf16..6e930d8ea0bb9b0bb9593e1569674e9ba2403346 100644 (file)
@@ -477,14 +477,18 @@ int i18n_ucalendar_country_timezones_create(const char *country, i18n_uenumerati
  *      reflect the change, i.e. the returned time zone will be the same as for the first function
  *      call.
  *
+ *      To query the system for the current timezone, use i18n_timezone_detect_host_timezone()
+ *      from the Timezone module.
+ *
  *      The default time zone may be changed with i18n_ucalendar_set_default_timezone()
  *      or with the i18n Timezone API.
+ *
  * @remarks The specific error code can be obtained using the get_last_result()
  *      method. Error codes are described in #i18n_error_code_e description.
  * @since_tizen 2.3.1
  *
  * @param[out] result A buffer to receive the result, or @c NULL
- * @param[in]     result_capacity The capacity of the @c result buffer
+ * @param[in]  result_capacity The capacity of the @c result buffer
  *
  * @return The @c result string length, not including the terminating @c NULL.
  * @exception #I18N_ERROR_NONE Successful
index e72d0857e92b6b7ac8e47f0855b0db28b8edf16f..23b4494b4e3d545410a38cf4f4449f436cee441d 100755 (executable)
@@ -447,3 +447,12 @@ int i18n_timezone_get_dst_savings(i18n_timezone_h timezone, int32_t *dst_savings
 
     return I18N_ERROR_NONE;
 }
+
+int i18n_timezone_detect_host_timezone(i18n_timezone_h *timezone)
+{
+    retv_if(timezone == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+    *timezone = TimeZone::detectHostTimeZone();
+
+    return I18N_ERROR_NONE;
+}