Fix static analysis issue 68/296668/2
authorilho kim <ilho159.kim@samsung.com>
Thu, 3 Aug 2023 02:24:55 +0000 (11:24 +0900)
committerilho kim <ilho159.kim@samsung.com>
Thu, 3 Aug 2023 06:12:31 +0000 (15:12 +0900)
'std::time_t' to 'long' may or may not override sign-bit depending on
size of implementation defined type
which may cause unexpected results on porting to different platforms

Change-Id: Ie4cfdc8f9e22e865d98b2b3ad2b918705f8beb5e
Signed-off-by: ilho kim <ilho159.kim@samsung.com>
src/wgt/step/configuration/step_parse.cc

index d40be87..7927042 100644 (file)
@@ -14,6 +14,7 @@
 #include <common/privileges.h>
 #include <common/step/step.h>
 #include <common/utils/glist_range.h>
+#include <common/utils/time_util.h>
 #include <manifest_parser/utils/version_number.h>
 #include <wgt_manifest_handlers/account_handler.h>
 #include <wgt_manifest_handlers/addon_handler.h>
@@ -39,7 +40,6 @@
 
 #include <string.h>
 
-#include <chrono>
 #include <cstdio>
 #include <cstdlib>
 #include <memory>
@@ -155,7 +155,6 @@ namespace wgt {
 namespace configuration {
 
 namespace app_keys = wgt::application_widget_keys;
-namespace sc = std::chrono;
 
 StepParse::StepParse(common_installer::InstallerContext* context,
                      ConfigLocation config_location,
@@ -182,9 +181,7 @@ std::string StepParse::GetPackageVersion(
 bool StepParse::FillInstallationInfo(manifest_x* manifest) {
   manifest->root_path = strdup(
       (context_->root_application_path.get() / manifest->package).c_str());
-  manifest->installed_time =
-      strdup(std::to_string(sc::system_clock::to_time_t(
-          sc::system_clock::now())).c_str());
+  manifest->installed_time = strdup(common_installer::GetCurrentTime().c_str());
   return true;
 }