New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[agw][mme] Replace ctime_r with strftime #4240
Conversation
Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
lte/gateway/c/oai/common/log.c
Outdated
time(cur_time); | ||
struct tm* cur_local_time; | ||
cur_local_time = localtime(cur_time); | ||
char* time_str = calloc(32, sizeof(char)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This array can be allocated on stack of caller to avoid dynamic memory allocation. Caller can pass explicit array pointer. is there any downside of this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes @pshelar, that is also a feasible approach. We will have to pass the array pointer as well as the array length to the function, increasing the number of arguments to the function. Alternatively, we can fix the size of the time_str using a macro and just use that everywhere. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified in 744d161
Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
* Replace ctime_r with strftime Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
* Replace ctime_r with strftime Signed-off-by: Shruti Sanadhya <ssanadhya@fb.com>
Signed-off-by: Shruti Sanadhya ssanadhya@fb.com
Summary
Replace ctime_r with recommended strftime
Test Plan
make integ_test
for functional testingtail /var/log/mme.log
to make sure the time is printed correctly