From bcca5d3ac57f17b8d4d34ca8c9172788c8da3dfd Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Tue, 20 Aug 2019 15:52:58 +0300 Subject: [core] Remove wrapper for std::chrono::system_clock::now() Better make it explict now that we no longer cast to time_point --- benchmark/storage/offline_database.benchmark.cpp | 2 +- bin/offline.cpp | 4 ++-- include/mbgl/storage/response.hpp | 4 ++-- include/mbgl/util/chrono.hpp | 4 ---- .../default/src/mbgl/storage/offline_database.cpp | 16 ++++++++-------- .../default/src/mbgl/storage/online_file_source.cpp | 6 +++--- src/mbgl/util/http_header.cpp | 2 +- src/mbgl/util/http_timeout.cpp | 4 ++-- test/map/map.test.cpp | 10 +++++----- test/storage/default_file_source.test.cpp | 20 ++++++++++---------- test/storage/http_file_source.test.cpp | 2 +- test/storage/offline_database.test.cpp | 14 +++++++------- test/storage/online_file_source.test.cpp | 14 +++++++------- test/util/http_timeout.test.cpp | 6 +++--- 14 files changed, 52 insertions(+), 56 deletions(-) diff --git a/benchmark/storage/offline_database.benchmark.cpp b/benchmark/storage/offline_database.benchmark.cpp index afdf6db4fc..ff4f2b2190 100644 --- a/benchmark/storage/offline_database.benchmark.cpp +++ b/benchmark/storage/offline_database.benchmark.cpp @@ -18,7 +18,7 @@ public: response.data = std::make_shared(50 * 1024, 0); response.mustRevalidate = false; - response.expires = mbgl::util::now() + 1h; + response.expires = mbgl::std::chrono::system_clock::now() + 1h; resetAmbientTiles(); resetRegion(); diff --git a/bin/offline.cpp b/bin/offline.cpp index fc8b0f1bd4..749f22ee2c 100644 --- a/bin/offline.cpp +++ b/bin/offline.cpp @@ -198,7 +198,7 @@ int main(int argc, char *argv[]) { fileSource(fileSource_), loop(loop_), mergePath(std::move(mergePath_)), - start(util::now()) { + start(std::chrono::system_clock::now()) { } void statusChanged(OfflineRegionStatus status) override { @@ -210,7 +210,7 @@ int main(int argc, char *argv[]) { std::string bytesPerSecond = "-"; - auto elapsedSeconds = (util::now() - start) / 1s; + auto elapsedSeconds = (std::chrono::system_clock::now() - start) / 1s; if (elapsedSeconds != 0) { bytesPerSecond = util::toString(status.completedResourceSize / elapsedSeconds); } diff --git a/include/mbgl/storage/response.hpp b/include/mbgl/storage/response.hpp index 07b059e435..235cb2edd6 100644 --- a/include/mbgl/storage/response.hpp +++ b/include/mbgl/storage/response.hpp @@ -38,13 +38,13 @@ public: optional etag; bool isFresh() const { - return expires ? *expires > util::now() : !error; + return expires ? *expires > std::chrono::system_clock::now() : !error; } // Indicates whether we are allowed to use this response according to HTTP caching rules. // It may or may not be stale. bool isUsable() const { - return !mustRevalidate || (expires && *expires > util::now()); + return !mustRevalidate || (expires && *expires > std::chrono::system_clock::now()); } }; diff --git a/include/mbgl/util/chrono.hpp b/include/mbgl/util/chrono.hpp index 63033627a1..98511e101c 100644 --- a/include/mbgl/util/chrono.hpp +++ b/include/mbgl/util/chrono.hpp @@ -16,10 +16,6 @@ using Timestamp = std::chrono::time_point; namespace util { -inline Timestamp now() { - return std::chrono::system_clock::now(); -} - // Returns the RFC1123 formatted date. E.g. "Tue, 04 Nov 2014 02:13:24 GMT" std::string rfc1123(Timestamp); diff --git a/platform/default/src/mbgl/storage/offline_database.cpp b/platform/default/src/mbgl/storage/offline_database.cpp index d85b560d5a..11be787611 100644 --- a/platform/default/src/mbgl/storage/offline_database.cpp +++ b/platform/default/src/mbgl/storage/offline_database.cpp @@ -279,7 +279,7 @@ optional> OfflineDatabase::getResource(const Resou // Update accessed timestamp used for LRU eviction. try { mapbox::sqlite::Query accessedQuery{ getStatement("UPDATE resources SET accessed = ?1 WHERE url = ?2") }; - accessedQuery.bind(1, util::now()); + accessedQuery.bind(1, std::chrono::system_clock::now()); accessedQuery.bind(2, resource.url); accessedQuery.run(); } catch (const mapbox::sqlite::Exception& ex) { @@ -352,7 +352,7 @@ bool OfflineDatabase::putResource(const Resource& resource, "WHERE url = ?4 ") }; // clang-format on - notModifiedQuery.bind(1, util::now()); + notModifiedQuery.bind(1, std::chrono::system_clock::now()); notModifiedQuery.bind(2, response.expires); notModifiedQuery.bind(3, response.mustRevalidate); notModifiedQuery.bind(4, resource.url); @@ -380,7 +380,7 @@ bool OfflineDatabase::putResource(const Resource& resource, updateQuery.bind(3, response.expires); updateQuery.bind(4, response.mustRevalidate); updateQuery.bind(5, response.modified); - updateQuery.bind(6, util::now()); + updateQuery.bind(6, std::chrono::system_clock::now()); updateQuery.bind(9, resource.url); if (response.noContent) { @@ -408,7 +408,7 @@ bool OfflineDatabase::putResource(const Resource& resource, insertQuery.bind(4, response.expires); insertQuery.bind(5, response.mustRevalidate); insertQuery.bind(6, response.modified); - insertQuery.bind(7, util::now()); + insertQuery.bind(7, std::chrono::system_clock::now()); if (response.noContent) { insertQuery.bind(8, nullptr); @@ -437,7 +437,7 @@ optional> OfflineDatabase::getTile(const Resource: " AND z = ?6 ") }; // clang-format on - accessedQuery.bind(1, util::now()); + accessedQuery.bind(1, std::chrono::system_clock::now()); accessedQuery.bind(2, tile.urlTemplate); accessedQuery.bind(3, tile.pixelRatio); accessedQuery.bind(4, tile.x); @@ -540,7 +540,7 @@ bool OfflineDatabase::putTile(const Resource::TileData& tile, " AND z = ?8 ") }; // clang-format on - notModifiedQuery.bind(1, util::now()); + notModifiedQuery.bind(1, std::chrono::system_clock::now()); notModifiedQuery.bind(2, response.expires); notModifiedQuery.bind(3, response.mustRevalidate); notModifiedQuery.bind(4, tile.urlTemplate); @@ -575,7 +575,7 @@ bool OfflineDatabase::putTile(const Resource::TileData& tile, updateQuery.bind(2, response.etag); updateQuery.bind(3, response.expires); updateQuery.bind(4, response.mustRevalidate); - updateQuery.bind(5, util::now()); + updateQuery.bind(5, std::chrono::system_clock::now()); updateQuery.bind(8, tile.urlTemplate); updateQuery.bind(9, tile.pixelRatio); updateQuery.bind(10, tile.x); @@ -610,7 +610,7 @@ bool OfflineDatabase::putTile(const Resource::TileData& tile, insertQuery.bind(7, response.mustRevalidate); insertQuery.bind(8, response.etag); insertQuery.bind(9, response.expires); - insertQuery.bind(10, util::now()); + insertQuery.bind(10, std::chrono::system_clock::now()); if (response.noContent) { insertQuery.bind(11, nullptr); diff --git a/platform/default/src/mbgl/storage/online_file_source.cpp b/platform/default/src/mbgl/storage/online_file_source.cpp index 87874f0c59..56b4e15284 100644 --- a/platform/default/src/mbgl/storage/online_file_source.cpp +++ b/platform/default/src/mbgl/storage/online_file_source.cpp @@ -328,7 +328,7 @@ void OnlineFileRequest::schedule() { if (resource.priorExpires) { schedule(resource.priorExpires); } else { - schedule(util::now()); + schedule(std::chrono::system_clock::now()); } } @@ -339,7 +339,7 @@ OnlineFileRequest::~OnlineFileRequest() { Timestamp interpolateExpiration(const Timestamp& current, optional prior, bool& expired) { - auto now = util::now(); + auto now = std::chrono::system_clock::now(); if (current > now) { return current; } @@ -461,7 +461,7 @@ void OnlineFileRequest::networkIsReachableAgain() { // We need all requests to fail at least once before we are going to start retrying // them, and we only immediately restart request that failed due to connection issues. if (failedRequestReason == Response::Error::Reason::Connection) { - schedule(util::now()); + schedule(std::chrono::system_clock::now()); } } diff --git a/src/mbgl/util/http_header.cpp b/src/mbgl/util/http_header.cpp index b318e979fa..6827452efe 100644 --- a/src/mbgl/util/http_header.cpp +++ b/src/mbgl/util/http_header.cpp @@ -23,7 +23,7 @@ CacheControl CacheControl::parse(const std::string& value) { } optional CacheControl::toTimePoint() const { - return maxAge ? util::now() + Seconds(*maxAge) : optional{}; + return maxAge ? std::chrono::system_clock::now() + Seconds(*maxAge) : optional{}; } optional parseRetryHeaders(const optional& retryAfter, diff --git a/src/mbgl/util/http_timeout.cpp b/src/mbgl/util/http_timeout.cpp index 18d53e237c..10d43e1588 100644 --- a/src/mbgl/util/http_timeout.cpp +++ b/src/mbgl/util/http_timeout.cpp @@ -18,7 +18,7 @@ Duration errorRetryTimeout(Response::Error::Reason failedRequestReason, uint32_t return Seconds(1u << std::min(failedRequests - 1, 31u)); } else if (failedRequestReason == Response::Error::Reason::RateLimit) { if (retryAfter) { - return *retryAfter - util::now(); + return *retryAfter - std::chrono::system_clock::now(); } else { // Default return Seconds(util::DEFAULT_RATE_LIMIT_TIMEOUT); @@ -33,7 +33,7 @@ Duration expirationTimeout(optional expires, uint32_t expiredRequests if (expiredRequests) { return Seconds(1u << std::min(expiredRequests - 1, 31u)); } else if (expires) { - return std::max(std::chrono::system_clock::duration::zero(), *expires - util::now()); + return std::max(std::chrono::system_clock::duration::zero(), *expires - std::chrono::system_clock::now()); } else { return Duration::max(); } diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index 8cb781c6df..e2f5f69f0d 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -433,7 +433,7 @@ TEST(Map, StyleExpired) { Response response; response.data = std::make_shared(util::read_file("test/fixtures/api/empty.json")); - response.expires = util::now() - 1h; + response.expires = std::chrono::system_clock::now() - 1h; test.fileSource->respond(Resource::Style, response); EXPECT_EQ(1u, test.fileSource->requests.size()); @@ -451,7 +451,7 @@ TEST(Map, StyleExpired) { // Send a fresh response, and confirm that we didn't overwrite the style, but continue to wait // for a fresh response. - response.expires = util::now() + 1h; + response.expires = std::chrono::system_clock::now() + 1h; test.fileSource->respond(Resource::Style, response); EXPECT_EQ(1u, test.fileSource->requests.size()); EXPECT_NE(nullptr, test.map.getStyle().getLayer("bg")); @@ -469,7 +469,7 @@ TEST(Map, StyleExpiredWithAnnotations) { Response response; response.data = std::make_shared(util::read_file("test/fixtures/api/empty.json")); - response.expires = util::now() - 1h; + response.expires = std::chrono::system_clock::now() - 1h; test.fileSource->respond(Resource::Style, response); EXPECT_EQ(1u, test.fileSource->requests.size()); @@ -493,7 +493,7 @@ TEST(Map, StyleExpiredWithRender) { Response response; response.data = std::make_shared(util::read_file("test/fixtures/api/empty.json")); - response.expires = util::now() - 1h; + response.expires = std::chrono::system_clock::now() - 1h; test.fileSource->respond(Resource::Style, response); EXPECT_EQ(1u, test.fileSource->requests.size()); @@ -787,7 +787,7 @@ TEST(Map, NoContentTiles) { // Insert a 204 No Content response for the 0/0/0 tile Response response; response.noContent = true; - response.expires = util::now() + 1h; + response.expires = std::chrono::system_clock::now() + 1h; test.fileSource->put(Resource::tile("http://example.com/{z}-{x}-{y}.vector.pbf", 1.0, 0, 0, 0, Tileset::Scheme::XYZ), response); diff --git a/test/storage/default_file_source.test.cpp b/test/storage/default_file_source.test.cpp index 38c7abb039..106785533f 100644 --- a/test/storage/default_file_source.test.cpp +++ b/test/storage/default_file_source.test.cpp @@ -258,7 +258,7 @@ TEST(DefaultFileSource, OptionalNonExpired) { Response response; response.data = std::make_shared("Cached value"); - response.expires = util::now() + 1h; + response.expires = system_clock::now() + 1h; fs.put(optionalResource, response); std::unique_ptr req; @@ -288,7 +288,7 @@ TEST(DefaultFileSource, OptionalExpired) { Response response; response.data = std::make_shared("Cached value"); - response.expires = util::now() - 1h; + response.expires = system_clock::now() - 1h; fs.put(optionalResource, response); std::unique_ptr req; @@ -363,7 +363,7 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheRefreshEtagNotModified)) { // Put a fake value into the cache to make sure we're not retrieving anything from the cache. Response response; response.data = std::make_shared("Cached value"); - response.expires = util::now() + 1h; + response.expires = system_clock::now() + 1h; fs.put(resource, response); std::unique_ptr req; @@ -373,7 +373,7 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheRefreshEtagNotModified)) { EXPECT_TRUE(res.notModified); EXPECT_FALSE(res.data.get()); ASSERT_TRUE(bool(res.expires)); - EXPECT_LT(util::now(), *res.expires); + EXPECT_LT(system_clock::now(), *res.expires); EXPECT_TRUE(res.mustRevalidate); EXPECT_FALSE(bool(res.modified)); ASSERT_TRUE(bool(res.etag)); @@ -398,7 +398,7 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheRefreshEtagModified)) { // Put a fake value into the cache to make sure we're not retrieving anything from the cache. Response response; response.data = std::make_shared("Cached value"); - response.expires = util::now() + 1h; + response.expires = system_clock::now() + 1h; fs.put(resource, response); std::unique_ptr req; @@ -432,7 +432,7 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheFull)) { // Put a fake value into the cache to make sure we're not retrieving anything from the cache. Response response; response.data = std::make_shared("Cached value"); - response.expires = util::now() + 1h; + response.expires = system_clock::now() + 1h; fs.put(resource, response); std::unique_ptr req; @@ -468,7 +468,7 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheRefreshModifiedNotModified)) // Put a fake value into the cache to make sure we're not retrieving anything from the cache. Response response; response.data = std::make_shared("Cached value"); - response.expires = util::now() + 1h; + response.expires = system_clock::now() + 1h; fs.put(resource, response); std::unique_ptr req; @@ -478,7 +478,7 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheRefreshModifiedNotModified)) EXPECT_TRUE(res.notModified); EXPECT_FALSE(res.data.get()); ASSERT_TRUE(bool(res.expires)); - EXPECT_LT(util::now(), *res.expires); + EXPECT_LT(system_clock::now(), *res.expires); EXPECT_TRUE(res.mustRevalidate); ASSERT_TRUE(bool(res.modified)); EXPECT_EQ(Timestamp{ Seconds(1420070400) }, *res.modified); @@ -504,7 +504,7 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheRefreshModifiedModified)) { // Put a fake value into the cache to make sure we're not retrieving anything from the cache. Response response; response.data = std::make_shared("Cached value"); - response.expires = util::now() + 1h; + response.expires = system_clock::now() + 1h; fs.put(resource, response); std::unique_ptr req; @@ -651,7 +651,7 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(RespondToStaleMustRevalidate)) { // return new data, only a 304 Not Modified response. EXPECT_EQ("Prior value", *res.data); ASSERT_TRUE(res.expires); - EXPECT_LE(util::now(), *res.expires); + EXPECT_LE(system_clock::now(), *res.expires); EXPECT_TRUE(res.mustRevalidate); ASSERT_TRUE(res.modified); EXPECT_EQ(Timestamp{ Seconds(1417392000) }, *res.modified); diff --git a/test/storage/http_file_source.test.cpp b/test/storage/http_file_source.test.cpp index 42b4174e69..bea4bbbb48 100644 --- a/test/storage/http_file_source.test.cpp +++ b/test/storage/http_file_source.test.cpp @@ -155,7 +155,7 @@ TEST(HTTPFileSource, TEST_REQUIRES_SERVER(CacheControlParsing)) { EXPECT_EQ(nullptr, res.error); ASSERT_TRUE(res.data.get()); EXPECT_EQ("Hello World!", *res.data); - EXPECT_GT(Seconds(2), util::abs(*res.expires - util::now() - Seconds(120))) << "Expiration date isn't about 120 seconds in the future"; + EXPECT_GT(Seconds(2), util::abs(*res.expires - std::chrono::system_clock::now() - Seconds(120))) << "Expiration date isn't about 120 seconds in the future"; EXPECT_FALSE(res.mustRevalidate); EXPECT_FALSE(bool(res.modified)); EXPECT_FALSE(bool(res.etag)); diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp index 3f6db527d4..a273ddbfd6 100644 --- a/test/storage/offline_database.test.cpp +++ b/test/storage/offline_database.test.cpp @@ -805,7 +805,7 @@ TEST(OfflineDatabase, Invalidate) { Response response; response.noContent = true; response.mustRevalidate = false; - response.expires = util::now() + 1h; + response.expires = std::chrono::system_clock::now() + 1h; const Resource ambientTile = Resource::tile("mapbox://tile_ambient", 1, 0, 0, 0, Tileset::Scheme::XYZ); db.put(ambientTile, response); @@ -861,12 +861,12 @@ TEST(OfflineDatabase, Invalidate) { EXPECT_TRUE(db.get(region2Style)->isUsable()); // Sanity check. - EXPECT_TRUE(db.get(ambientTile)->expires < util::now()); - EXPECT_TRUE(db.get(ambientStyle)->expires < util::now()); - EXPECT_TRUE(db.get(region1Tile)->expires < util::now()); - EXPECT_TRUE(db.get(region1Style)->expires < util::now()); - EXPECT_TRUE(db.get(region2Tile)->expires > util::now()); - EXPECT_TRUE(db.get(region2Style)->expires > util::now()); + EXPECT_TRUE(db.get(ambientTile)->expires < std::chrono::system_clock::now()); + EXPECT_TRUE(db.get(ambientStyle)->expires < std::chrono::system_clock::now()); + EXPECT_TRUE(db.get(region1Tile)->expires < std::chrono::system_clock::now()); + EXPECT_TRUE(db.get(region1Style)->expires < std::chrono::system_clock::now()); + EXPECT_TRUE(db.get(region2Tile)->expires > std::chrono::system_clock::now()); + EXPECT_TRUE(db.get(region2Style)->expires > std::chrono::system_clock::now()); EXPECT_TRUE(db.get(ambientTile)->mustRevalidate); EXPECT_TRUE(db.get(ambientStyle)->mustRevalidate); diff --git a/test/storage/online_file_source.test.cpp b/test/storage/online_file_source.test.cpp index 9d4b4fc190..08671b35a0 100644 --- a/test/storage/online_file_source.test.cpp +++ b/test/storage/online_file_source.test.cpp @@ -155,7 +155,7 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RetryDelayOnExpiredTile)) { std::unique_ptr req = fs.request(resource, [&](Response res) { counter++; EXPECT_EQ(nullptr, res.error); - EXPECT_GT(util::now(), *res.expires); + EXPECT_GT(std::chrono::system_clock::now(), *res.expires); EXPECT_FALSE(res.mustRevalidate); }); @@ -181,12 +181,12 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RetryOnClockSkew)) { switch (counter++) { case 0: { EXPECT_EQ(nullptr, res.error); - EXPECT_GT(util::now(), *res.expires); + EXPECT_GT(std::chrono::system_clock::now(), *res.expires); } break; case 1: { EXPECT_EQ(nullptr, res.error); - auto now = util::now(); + auto now = std::chrono::system_clock::now(); EXPECT_LT(now + Seconds(40), *res.expires) << "Expiration not interpolated to 60s"; EXPECT_GT(now + Seconds(80), *res.expires) << "Expiration not interpolated to 60s"; @@ -204,7 +204,7 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RespectPriorExpires)) { // Very long expiration time, should never arrive. Resource resource1{ Resource::Unknown, "http://127.0.0.1:3000/test" }; - resource1.priorExpires = util::now() + Seconds(100000); + resource1.priorExpires = std::chrono::system_clock::now() + Seconds(100000); std::unique_ptr req1 = fs.request(resource1, [&](Response) { FAIL() << "Should never be called"; @@ -219,7 +219,7 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RespectPriorExpires)) { // Very long expiration time, should never arrive. Resource resource3{ Resource::Unknown, "http://127.0.0.1:3000/test" }; - resource3.priorExpires = util::now() + Seconds(100000); + resource3.priorExpires = std::chrono::system_clock::now() + Seconds(100000); std::unique_ptr req3 = fs.request(resource3, [&](Response) { FAIL() << "Should never be called"; @@ -380,7 +380,7 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitStandard)) { ASSERT_NE(nullptr, res.error); EXPECT_EQ(Response::Error::Reason::RateLimit, res.error->reason); ASSERT_EQ(true, bool(res.error->retryAfter)); - ASSERT_LT(util::now(), res.error->retryAfter); + ASSERT_LT(std::chrono::system_clock::now(), res.error->retryAfter); loop.stop(); }); @@ -395,7 +395,7 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitMBX)) { ASSERT_NE(nullptr, res.error); EXPECT_EQ(Response::Error::Reason::RateLimit, res.error->reason); ASSERT_EQ(true, bool(res.error->retryAfter)); - ASSERT_LT(util::now(), res.error->retryAfter); + ASSERT_LT(std::chrono::system_clock::now(), res.error->retryAfter); loop.stop(); }); diff --git a/test/util/http_timeout.test.cpp b/test/util/http_timeout.test.cpp index e696cd1c9c..886b404b1d 100644 --- a/test/util/http_timeout.test.cpp +++ b/test/util/http_timeout.test.cpp @@ -34,7 +34,7 @@ TEST(HttpRetry, ConnectionError) { TEST(HttpRetry, RateLimit) { // Pre-set value from header - ASSERT_EQ(Seconds(1), errorRetryTimeout(Response::Error::Reason::Server, 1, { util::now() + Seconds(1) })); + ASSERT_EQ(Seconds(1), errorRetryTimeout(Response::Error::Reason::Server, 1, { std::chrono::system_clock::now() + Seconds(1) })); // Default ASSERT_EQ(Seconds(5), errorRetryTimeout(Response::Error::Reason::RateLimit, 1, {})); @@ -42,8 +42,8 @@ TEST(HttpRetry, RateLimit) { TEST(HttpRetry, ExpiredInitial) { // 1 sec timeout, will not be exactly 1 because of precision/rounding - ASSERT_TRUE(Milliseconds(1000) >= expirationTimeout({ util::now() + Seconds(1) }, 0)); - ASSERT_TRUE(Milliseconds(990) < expirationTimeout({ util::now() + Seconds(1) }, 0)); + ASSERT_TRUE(Milliseconds(1000) >= expirationTimeout({ std::chrono::system_clock::now() + Seconds(1) }, 0)); + ASSERT_TRUE(Milliseconds(990) < expirationTimeout({ std::chrono::system_clock::now() + Seconds(1) }, 0)); } TEST(HttpRetry, ExpiredSubsequent) { -- cgit v1.2.1