diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-12-16 21:34:54 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-16 21:34:54 -0600 |
commit | 8a02ad01e25ed2483bd0f1c8abdec8eabf44634a (patch) | |
tree | 253ee93b860f20a9c1deeb4cf0f6a31945bf6bf8 /vespalib | |
parent | 2f8e6f0cb74ef77a645e7543975aca736f7649a9 (diff) |
Revert "Balder/remove steadytimestamp 2"
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/tests/time/time_test.cpp | 10 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/testkit/test_comparators.cpp | 6 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/testkit/test_comparators.h | 2 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/time.cpp | 7 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/time.h | 6 |
5 files changed, 2 insertions, 29 deletions
diff --git a/vespalib/src/tests/time/time_test.cpp b/vespalib/src/tests/time/time_test.cpp index 40542b6ca62..667511f6a94 100644 --- a/vespalib/src/tests/time/time_test.cpp +++ b/vespalib/src/tests/time/time_test.cpp @@ -29,16 +29,6 @@ TEST(TimeTest, double_conversion_works_as_expected) { EXPECT_EQ(10ms, from_s(0.010)); } -TEST(TimeTest, timeval_conversion_works_as_expected) { - timeval tv1; - tv1.tv_sec = 7; - tv1.tv_usec = 342356; - EXPECT_EQ(from_timeval(tv1), 7342356us); - tv1.tv_sec = 7; - tv1.tv_usec = 1342356; - EXPECT_EQ(from_timeval(tv1), 8342356us); -} - TEST(TimeTest, unit_counting_works_as_expected) { auto d = 3ms + 5us + 7ns; EXPECT_EQ(count_ns(d), 3005007); diff --git a/vespalib/src/vespa/vespalib/testkit/test_comparators.cpp b/vespalib/src/vespa/vespalib/testkit/test_comparators.cpp index b30b3aaa421..d00ad8d954c 100644 --- a/vespalib/src/vespa/vespalib/testkit/test_comparators.cpp +++ b/vespalib/src/vespa/vespalib/testkit/test_comparators.cpp @@ -8,11 +8,7 @@ ostream & operator << (ostream & os, system_clock::time_point ts) { return os << ts.time_since_epoch() << "ns"; } -ostream & operator << (ostream & os, steady_clock::time_point ts) { - return os << ts.time_since_epoch() << "ns"; -} - } namespace vespalib { -}
\ No newline at end of file +} // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/testkit/test_comparators.h b/vespalib/src/vespa/vespalib/testkit/test_comparators.h index 164e486cf4a..161c125757b 100644 --- a/vespalib/src/vespa/vespalib/testkit/test_comparators.h +++ b/vespalib/src/vespa/vespalib/testkit/test_comparators.h @@ -14,7 +14,7 @@ ostream & operator << (ostream & os, duration<rep, period> ts) { } ostream & operator << (ostream & os, system_clock::time_point ts); -ostream & operator << (ostream & os, steady_clock::time_point ts); + } diff --git a/vespalib/src/vespa/vespalib/util/time.cpp b/vespalib/src/vespa/vespalib/util/time.cpp index fdd13849287..d38e40a6d6a 100644 --- a/vespalib/src/vespa/vespalib/util/time.cpp +++ b/vespalib/src/vespa/vespalib/util/time.cpp @@ -4,13 +4,6 @@ namespace vespalib { -system_time -to_utc(steady_time ts) { - system_clock::time_point nowUtc = system_clock::now(); - steady_time nowSteady = steady_clock::now(); - return system_time(nowUtc.time_since_epoch() - nowSteady.time_since_epoch() + ts.time_since_epoch()); -} - Timer::~Timer() = default; } diff --git a/vespalib/src/vespa/vespalib/util/time.h b/vespalib/src/vespa/vespalib/util/time.h index 3111239ffab..2f8ae0ae016 100644 --- a/vespalib/src/vespa/vespalib/util/time.h +++ b/vespalib/src/vespa/vespalib/util/time.h @@ -39,8 +39,6 @@ constexpr double to_s(duration d) { return std::chrono::duration_cast<std::chrono::duration<double>>(d).count(); } -system_time to_utc(steady_time ts); - constexpr duration from_s(double seconds) { return std::chrono::duration_cast<duration>(std::chrono::duration<double>(seconds)); } @@ -57,10 +55,6 @@ constexpr int64_t count_ns(duration d) { return std::chrono::duration_cast<std::chrono::nanoseconds>(d).count(); } -constexpr duration from_timeval(const timeval & tv) { - return duration(tv.tv_sec*1000000000L + tv.tv_usec*1000L); -} - /** * Simple utility class used to measure how much time has elapsed * since it was constructed. |