Skip to content

Using a correct time in log file #730

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion options.c
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ static time_t parse_time(const char *arg)
{
const char *cp;
time_t val, now = time(NULL);
struct tm t, *today = localtime(&now);
struct tm t, tmp, *today = localtime_r(&now, &tmp);
int in_date, old_mday, n;

memset(&t, 0, sizeof t);
Expand Down
2 changes: 1 addition & 1 deletion tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static void storetime(char *dest, size_t destsize, time_t t, int nsecs)
{
if (t) {
int len;
struct tm *mt = gmtime(&t);
struct tm tmp, *mt = gmtime_r(&t, &tmp);

len = snprintf(dest, destsize,
" %04d-%02d-%02d %02d:%02d:%02d",
Expand Down
2 changes: 1 addition & 1 deletion util1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ char *timestring(time_t t)
static int ndx = 0;
static char buffers[4][20]; /* We support 4 simultaneous timestring results. */
char *TimeBuf = buffers[ndx = (ndx + 1) % 4];
struct tm *tm = localtime(&t);
struct tm tmp, *tm = localtime_r(&t, &tmp);
int len = snprintf(TimeBuf, sizeof buffers[0], "%4d/%02d/%02d %02d:%02d:%02d",
(int)tm->tm_year + 1900, (int)tm->tm_mon + 1, (int)tm->tm_mday,
(int)tm->tm_hour, (int)tm->tm_min, (int)tm->tm_sec);
Expand Down
Loading