X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmonitor%2Fstc-time.c;h=1f30f96f245c36581d5da425e63f2d55d56fc012;hb=3ca1e9a9437c93591a7ca10328e543296156aeeb;hp=750b43d413960b5007268a1ab0b976b90952f6a5;hpb=1b21d2dd6e6a51192bad23b595cebdbd810bffd2;p=platform%2Fcore%2Fconnectivity%2Fstc-manager.git diff --git a/src/monitor/stc-time.c b/src/monitor/stc-time.c index 750b43d..1f30f96 100644 --- a/src/monitor/stc-time.c +++ b/src/monitor/stc-time.c @@ -22,34 +22,36 @@ 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) { - struct tm *curr; + struct tm curr; + struct tm *res; int days; - 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; - if (curr->tm_wday > 1) - days = curr->tm_wday - 1; + if (curr.tm_wday > 1) + days = curr.tm_wday - 1; else - days = 1 - curr->tm_wday; + days = 1 - curr.tm_wday; - return (mktime(curr) - (days * SEC_IN_DAY)); + return (mktime(&curr) - (days * SEC_IN_DAY)); } time_t stc_time_get_month_start(time_t now, int month_start_date)