gmtime_r converts local time to UTC, however mktime only takes an
argument as local time. Use localtime_r instead of gmtime_r will fix.
Fixes: #14862
Reported-by: isyippee <yippee_liu@163.com>
Signed-off-by: Zhao Chao <zhaochao1984@gmail.com>
utime_t round_to_minute() {
struct tm bdt;
time_t tt = sec();
- gmtime_r(&tt, &bdt);
+ localtime_r(&tt, &bdt);
bdt.tm_sec = 0;
tt = mktime(&bdt);
return utime_t(tt, 0);
utime_t round_to_hour() {
struct tm bdt;
time_t tt = sec();
- gmtime_r(&tt, &bdt);
+ localtime_r(&tt, &bdt);
bdt.tm_sec = 0;
bdt.tm_min = 0;
tt = mktime(&bdt);