Add new API getting installed time for given package 61/118561/6
authorjongmyeongko <jongmyeong.ko@samsung.com>
Mon, 13 Mar 2017 07:07:55 +0000 (16:07 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Tue, 28 Mar 2017 06:51:52 +0000 (15:51 +0900)
Change-Id: Ide73e7797d0c7adb9b5a6783abb1635c6461bb21
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
include/package_info.h
src/package_info.c

index b9403d0..ea2fdb1 100644 (file)
@@ -358,6 +358,20 @@ int package_info_is_equal(package_info_h lhs, package_info_h rhs, bool *equal);
  */
 int package_info_is_accessible(package_info_h package_info, bool *accessible);
 
+/**
+ * @brief Gets the installed time for the given package.
+ * @details If the package was updated, the @a installed_time represents updated time.
+ *          So, the meaning of 'installed time' corresponds with 'last modified time'.
+ * @since_tizen 4.0
+ * @param[in]  package_info   The package information
+ * @param[out] installed_time The integer value of time_t type for installed time
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Database error occurred
+ */
+int package_info_get_installed_time(package_info_h package_info, int *installed_time);
 
 /**
  * @brief Clones the package information handle.
@@ -373,7 +387,6 @@ int package_info_is_accessible(package_info_h package_info, bool *accessible);
  */
 int package_info_clone(package_info_h *clone, package_info_h package_info);
 
-
 /**
  * @brief Gets the package information for the given package
  * @since_tizen 2.3
index 8cb1cd8..cf3aba7 100644 (file)
@@ -397,6 +397,23 @@ API int package_info_is_accessible(package_info_h package_info, bool *accessible
        return PACKAGE_MANAGER_ERROR_NONE;
 }
 
+API int package_info_get_installed_time(package_info_h package_info, int *installed_time)
+{
+       int ret;
+       int time_value;
+
+       if (package_info == NULL || installed_time == NULL)
+               return package_manager_error(PACKAGE_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+       ret = pkgmgrinfo_pkginfo_get_installed_time(package_info->pkgmgr_pkginfo, &time_value);
+       if (ret < 0)
+               return package_manager_error(PACKAGE_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
+
+       *installed_time = time_value;
+
+       return PACKAGE_MANAGER_ERROR_NONE;
+}
+
 API int package_info_clone(package_info_h *clone, package_info_h package_info)
 {
        int retval;