spdycat: Rewritten time_delta

This commit is contained in:
Tatsuhiro Tsujikawa 2012-10-04 23:54:39 +09:00
parent 53b7b0eda9
commit 9378b74fc3
1 changed files with 3 additions and 9 deletions

View File

@ -398,15 +398,9 @@ void on_stream_close_callback
int64_t time_delta(const timeval& a, const timeval& b) int64_t time_delta(const timeval& a, const timeval& b)
{ {
int64_t res; int64_t res = (a.tv_sec - b.tv_sec) * 1000;
res = a.tv_usec - b.tv_usec; res += (a.tv_usec - b.tv_usec) / 1000;
int off = 0; return res;
if(res < 0) {
res += 1000000;
off = -1;
}
res += (a.tv_sec + off - b.tv_sec)*1000000;
return res/1000;
} }
void print_stats(const SpdySession& spdySession) void print_stats(const SpdySession& spdySession)