[Fix] Use localtime_r() instead of localtime() 89/192989/3
authorMilind Murhekar <m.murhekar@samsung.com>
Tue, 13 Nov 2018 11:07:39 +0000 (16:37 +0530)
committerMilind Murhekar <m.murhekar@samsung.com>
Tue, 13 Nov 2018 13:15:50 +0000 (18:45 +0530)
Description: This patch fixes the DF180802-00044
issue.

Change-Id: I0eb1ea1c6da97923993a9a5a6d99b67b2c5e6bde
Signed-off-by: Milind Murhekar <m.murhekar@samsung.com>
src/monitor/stc-time.c

index 750b43d..81e7a0f 100644 (file)
 
 time_t stc_time_get_day_start(time_t now)
 {
-       struct tm *curr;
+       struct tm curr;
+       struct tm *res;
 
-       curr = localtime(&now);
+       res = localtime_r(&now, &curr);
 
-       curr->tm_sec = 0;
-       curr->tm_min = 0;
-       curr->tm_hour = 0;
+       curr.tm_sec = 0;
+       curr.tm_min = 0;
+       curr.tm_hour = 0;
 
-       return mktime(curr);
+       return mktime(&curr);
 }
 
 time_t stc_time_get_week_start(time_t now)