projects
/
platform
/
core
/
connectivity
/
stc-manager.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "[Fix] Use localtime_r() instead of localtime()" into tizen
[platform/core/connectivity/stc-manager.git]
/
src
/
monitor
/
stc-time.c
diff --git
a/src/monitor/stc-time.c
b/src/monitor/stc-time.c
index
750b43d
..
1f30f96
100644
(file)
--- 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)
{
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)
{
}
time_t stc_time_get_week_start(time_t now)
{
- struct tm *curr;
+ struct tm curr;
+ struct tm *res;
int days;
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
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)
}
time_t stc_time_get_month_start(time_t now, int month_start_date)