heart-battery: Change long type to time_t to solve type mismatch 06/317406/1
authorUnsung Lee <unsung.lee@samsung.com>
Thu, 2 Jan 2025 05:06:13 +0000 (14:06 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Thu, 2 Jan 2025 05:06:15 +0000 (14:06 +0900)
Change long type to time_t to solve the problem caused by type mismatch
between long and time_t. Previously, a time_t variable was changed and
stored as a long type variable. It may override sign-bit
depending on size of implementation defiend type.

Change-Id: I869322a1f431d1247d725c800dd4df43dc08eb2a
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/resource-monitor/heart-battery.c

index 9cf2c49a722ab9ea82e1da041a574405573ff5c9..53f528780682dbe85a598a22566b0595cdab2428 100644 (file)
@@ -173,15 +173,15 @@ enum {
 /* Structure to calculate percentage time LCD on during charging */
 struct rul_lcd_data {
        display_state_e state;
-       long on_time;
-       long on_start_time;
-       long on_stop_time;
+       time_t on_time;
+       time_t on_start_time;
+       time_t on_stop_time;
 };
 
 /* Structure to store RUL related charging info  */
 struct rul_info {
-       long charging_start_time;
-       long charging_stop_time;
+       time_t charging_start_time;
+       time_t charging_stop_time;
        float raw_capacity; /* capacity (mAh) accumulation during charging */
        int soc_start; /* SoC(%) value when charging starts */
        int soc_stop; /* SoC(%) value when charging stops */
@@ -2292,7 +2292,7 @@ static void rul_write_data_to_file(void)
 static void rul_charging_cycle_end_work(void)
 {
        int capacity;
-       long total_charging_time;
+       time_t total_charging_time;
        bool lcd_on_time_check;
        float lcd_on_ratio = 1.0f;
 
@@ -2341,8 +2341,8 @@ static void rul_calculate_raw_capacity(void)
         * If capacity = 100%, dump collected data
         */
 
-       long rul_curr_time, rul_time_interval;
-       static long prev_charging_time;
+       time_t rul_curr_time, rul_time_interval;
+       static time_t prev_charging_time;
        int fg_curr_inst, capacity, ret;
        float fg_curr_inst_f;
        static float prev_fg_curr_inst_f = 0.0f;