Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

fix(utils): fix bug in time_utils #395

Merged
merged 8 commits into from
Feb 13, 2020
Merged

Conversation

levy5307
Copy link
Contributor

There is a function in time_utils, which name is get_localtime. It calls localtime_r(const time_t *timep, struct tm *result) and return the return value of this function.
While localtime_r needs the second parameter, the struct tm *result, as a buffer to store the return value. But in our get_localtime function, it pass a local variable to localtime_r. And after it returns, the local variable is destroyed. So this leads to some undefined errors.

@levy5307 levy5307 changed the title bugfix(utils): fix bug in time_utils fix(utils): fix bug in time_utils Feb 13, 2020
@levy5307
Copy link
Contributor Author

levy5307 commented Feb 13, 2020

本来为time_ms_to_string/time_ms_to_date/time_ms_to_date_time/time_ms_to_date_time这四个function添加了单测的,后来发现由于github上ci和本地时区不一样,导致转换出来的时间不一样,这样ci上单测跑不过

@levy5307 levy5307 merged commit 0db7b36 into XiaoMi:master Feb 13, 2020
@neverchanje neverchanje added the type/bug-fix This PR fixes a bug. label Mar 31, 2020
neverchanje pushed a commit that referenced this pull request Mar 31, 2020
@levy5307 levy5307 deleted the time-bugfix branch May 26, 2020 06:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.12.3 type/bug-fix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants