From 7b063928124da85d7b1ae9c634bb848bf9b2f8c5 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Wed, 30 Mar 2011 00:29:07 +0000 Subject: [PATCH] Don't explicitly protect against non-monotonic gettimeofday. Since we're now protecting against non-monotonic time unconditionally, there's no need for additional protection in the gettimeofday case. --- third-party/libutp/utp_utils.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/third-party/libutp/utp_utils.cpp b/third-party/libutp/utp_utils.cpp index fa66e1339..cb8f95fa8 100644 --- a/third-party/libutp/utp_utils.cpp +++ b/third-party/libutp/utp_utils.cpp @@ -141,15 +141,8 @@ static uint64_t GetMicroseconds() } #endif { - static time_t offset = 0, previous = 0; struct timeval tv; rc = gettimeofday(&tv, NULL); - tv.tv_sec += offset; - if (previous > tv.tv_sec) { - offset += previous - tv.tv_sec; - tv.tv_sec = previous; - } - previous = tv.tv_sec; return uint64(tv.tv_sec) * 1000000 + tv.tv_usec; } }