For Y2K38 on 32 bit systems time_t tv_sec can be long long

This commit is contained in:
Robert Scheck 2023-02-05 01:34:23 +01:00
parent 4ceeb2efc9
commit 623c14d0fd

View file

@ -714,26 +714,26 @@ int ssl_print_timestamp(ssl,ts)
jobj = ssl->cur_json_st; jobj = ssl->cur_json_st;
if(jobj) { if(jobj) {
snprintf(ts_str,40, "%ld%c%4.4ld",ts->tv_sec,'.',ts->tv_usec/100); snprintf(ts_str,40, "%lld%c%4.4lld",(long long)ts->tv_sec,'.',(long long)ts->tv_usec/100);
json_object *j_ts_str = json_object_new_string(ts_str); json_object *j_ts_str = json_object_new_string(ts_str);
json_object_object_add(jobj, "timestamp", j_ts_str); json_object_object_add(jobj, "timestamp", j_ts_str);
} }
if(SSL_print_flags & SSL_PRINT_TIMESTAMP_ABSOLUTE) { if(SSL_print_flags & SSL_PRINT_TIMESTAMP_ABSOLUTE) {
if(!(SSL_print_flags & SSL_PRINT_JSON)) if(!(SSL_print_flags & SSL_PRINT_JSON))
explain(ssl,"%d%c%4.4d ",ts->tv_sec,'.',ts->tv_usec/100); explain(ssl,"%lld%c%4.4lld ",(long long)ts->tv_sec,'.',(long long)ts->tv_usec/100);
} }
else{ else{
if((r=timestamp_diff(ts,&ssl->time_start,&dt))) if((r=timestamp_diff(ts,&ssl->time_start,&dt)))
ERETURN(r); ERETURN(r);
if(!(SSL_print_flags & SSL_PRINT_JSON)) if(!(SSL_print_flags & SSL_PRINT_JSON))
explain(ssl,"%d%c%4.4d ",dt.tv_sec,'.',dt.tv_usec/100); explain(ssl,"%lld%c%4.4lld ",(long long)dt.tv_sec,'.',(long long)dt.tv_usec/100);
} }
if((r=timestamp_diff(ts,&ssl->time_last,&dt))){ if((r=timestamp_diff(ts,&ssl->time_last,&dt))){
ERETURN(r); ERETURN(r);
} }
if(!(SSL_print_flags & SSL_PRINT_JSON)) if(!(SSL_print_flags & SSL_PRINT_JSON))
explain(ssl,"(%d%c%4.4d) ",dt.tv_sec,'.',dt.tv_usec/100); explain(ssl,"(%lld%c%4.4lld) ",(long long)dt.tv_sec,'.',(long long)dt.tv_usec/100);
memcpy(&ssl->time_last,ts,sizeof(struct timeval)); memcpy(&ssl->time_last,ts,sizeof(struct timeval));