Skip to content
Merged
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
7 changes: 5 additions & 2 deletions plugins/esi/combo_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,8 @@ prepareResponse(InterceptData &int_data, ByteBlockList &body_blocks, string &res
resp_header_fields.append("Expires: 0\r\n");
} else {
char line_buf[128];
int line_size = strftime(line_buf, 128, "Expires: %a, %d %b %Y %T GMT\r\n", gmtime(&expires_time));
struct tm gm_expires_time;
int line_size = strftime(line_buf, 128, "Expires: %a, %d %b %Y %T GMT\r\n", gmtime_r(&expires_time, &gm_expires_time));
resp_header_fields.append(line_buf, line_size);
}
}
Expand Down Expand Up @@ -1188,7 +1189,9 @@ writeStandardHeaderFields(InterceptData &int_data, int &n_bytes_written)
if (find(HEADER_WHITELIST.begin(), HEADER_WHITELIST.end(), TS_MIME_FIELD_LAST_MODIFIED) == HEADER_WHITELIST.end()) {
time_t time_now = static_cast<time_t>(TShrtime() / 1000000000); // it returns nanoseconds!
char last_modified_line[128];
int last_modified_line_size = strftime(last_modified_line, 128, "Last-Modified: %a, %d %b %Y %T GMT\r\n", gmtime(&time_now));
struct tm gmnow;
int last_modified_line_size =
strftime(last_modified_line, 128, "Last-Modified: %a, %d %b %Y %T GMT\r\n", gmtime_r(&time_now, &gmnow));
if (TSIOBufferWrite(int_data.output.buffer, last_modified_line, last_modified_line_size) == TS_ERROR) {
LOG_ERROR("Error while writing last-modified fields");
return false;
Expand Down
14 changes: 8 additions & 6 deletions src/traffic_top/traffic_top.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,11 @@ help(const string &host, const string &version)

while (true) {
clear();
time_t now = time(nullptr);
struct tm *nowtm = localtime(&now);
time_t now = time(nullptr);
struct tm nowtm;
char timeBuf[32];
strftime(timeBuf, sizeof(timeBuf), "%H:%M:%S", nowtm);
localtime_r(&now, &nowtm);
strftime(timeBuf, sizeof(timeBuf), "%H:%M:%S", &nowtm);

// clear();
attron(A_BOLD);
Expand Down Expand Up @@ -467,10 +468,11 @@ main(int argc, const char **argv)
attron(A_BOLD);

string version;
time_t now = time(nullptr);
struct tm *nowtm = localtime(&now);
time_t now = time(nullptr);
struct tm nowtm;
char timeBuf[32];
strftime(timeBuf, sizeof(timeBuf), "%H:%M:%S", nowtm);
localtime_r(&now, &nowtm);
strftime(timeBuf, sizeof(timeBuf), "%H:%M:%S", &nowtm);
stats.getStat("version", version);

mvprintw(23, 0, "%-20.20s %30s (q)uit (h)elp (%c)bsolute ", host.c_str(), page_alt.c_str(), absolute ? 'A' : 'a');
Expand Down
4 changes: 2 additions & 2 deletions tools/http_load/http_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -2760,9 +2760,9 @@ idle_connection(ClientData client_data, struct timeval *nowP __attribute__((unus
int cnum;
struct timeval tv;
char strTime[32];

struct tm localtv;
gettimeofday(&tv, NULL);
strftime(strTime, 32, "%T", localtime(&tv.tv_sec));
strftime(strTime, 32, "%T", localtime_r(&tv.tv_sec, &localtv));

cnum = client_data.i;
connections[cnum].idle_timer = (Timer *)0;
Expand Down