File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -349,6 +349,7 @@ cmd_http_request(
349349 hr .fw_state = state ;
350350 gettimeofday (& hr .timestamp1 , 0 );
351351 hr .current_time = hr .timestamp1 .tv_sec ;
352+ hr .current_time_us = hr .timestamp1 .tv_sec * 1000000LL + hr .timestamp1 .tv_usec ;
352353 hr .locale_id = -1 ;
353354
354355 if (pkt_size < sizeof (* pkt ))
@@ -624,6 +625,7 @@ handle_ws_request(
624625 hr .fw_state = state ;
625626 gettimeofday (& hr .timestamp1 , 0 );
626627 hr .current_time = hr .timestamp1 .tv_sec ;
628+ hr .current_time_us = hr .timestamp1 .tv_sec * 1000000LL + hr .timestamp1 .tv_usec ;
627629 hr .locale_id = -1 ;
628630 hr .config = ejudge_config ;
629631 hr .json = root ;
Original file line number Diff line number Diff line change 642642%>
643643
644644<%
645- gettimeofday(&phr->timestamp2, 0);
646- tdiff = ((long long) phr->timestamp2.tv_sec) * 1000000;
647- tdiff += phr->timestamp2.tv_usec;
648- tdiff -= ((long long) phr->timestamp1.tv_sec) * 1000000;
649- tdiff -= phr->timestamp1.tv_usec;
645+ struct timeval timestamp2;
646+ gettimeofday(×tamp2, NULL);
647+ long long ts2 = timestamp2.tv_sec * 1000000LL + timestamp2.tv_usec;
648+ tdiff = ts2 - phr->current_time_us;
650649%>
651650
652651<div class="dotted"><p<s:v escape="false" value="cnts->team_par_style" />><s:_>Page generation time</s:_>: <s:v value="tdiff / 1000" /> <s:_>msec</s:_></p></div>
Original file line number Diff line number Diff line change @@ -119,8 +119,10 @@ struct http_request_info
119119 unsigned char content_type [128 ];
120120
121121 time_t current_time ;
122+ // this time is used in priv-main-page to estimate generation time
122123 struct timeval timestamp1 ;
123- struct timeval timestamp2 ;
124+ // microsecond precision current time
125+ long long current_time_us ;
124126
125127 const struct contest_desc * cnts ;
126128 struct contest_extra * extra ;
You can’t perform that action at this time.
0 commit comments