summaryrefslogtreecommitdiffstats
path: root/base/chrono_utils_test.cpp
diff options
context:
space:
mode:
authorJames Hawkins <jhawkins@google.com>2017-02-08 14:16:25 -0800
committerJames Hawkins <jhawkins@google.com>2017-02-08 14:16:51 -0800
commit0e3167e203ae89817cc30ba4a5a2d328716b4826 (patch)
treeb265be245dfd10cf677fe78bdedfec2e70da7336 /base/chrono_utils_test.cpp
parentec5d6cb8fdcabaaaba2836712f5b7ee58321c3b8 (diff)
downloadsystem_core-0e3167e203ae89817cc30ba4a5a2d328716b4826.tar.gz
system_core-0e3167e203ae89817cc30ba4a5a2d328716b4826.tar.bz2
system_core-0e3167e203ae89817cc30ba4a5a2d328716b4826.zip
Revert "bootstat: Remove custom uptime parser in favor of elapsedRealtime."
This reverts commit 26f40c04c3ad80e2bc449990010d39d1c1b9a5f0. This change broke the Darwin SDK target. Test: none Change-Id: Ia54fe2c31da8d8fa2825e023b035fb8321dcd457
Diffstat (limited to 'base/chrono_utils_test.cpp')
-rw-r--r--base/chrono_utils_test.cpp47
1 files changed, 0 insertions, 47 deletions
diff --git a/base/chrono_utils_test.cpp b/base/chrono_utils_test.cpp
deleted file mode 100644
index bc6df4b9a..000000000
--- a/base/chrono_utils_test.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "android-base/chrono_utils.h"
-
-#include <time.h>
-
-#include <chrono>
-
-#include <gtest/gtest.h>
-
-namespace android {
-namespace base {
-
-std::chrono::seconds GetBootTimeSeconds() {
- struct timespec now;
- clock_gettime(CLOCK_BOOTTIME, &now);
-
- auto now_tp = boot_clock::time_point(
- std::chrono::seconds(now.tv_sec) + std::chrono::nanoseconds(now.tv_nsec));
- return std::chrono::duration_cast<std::chrono::seconds>(
- now_tp.time_since_epoch());
-}
-
-// Tests (at least) the seconds accuracy of the boot_clock::now() method.
-TEST(ChronoUtilsTest, BootClockNowSeconds) {
- auto now = GetBootTimeSeconds();
- auto boot_seconds = std::chrono::duration_cast<std::chrono::seconds>(
- boot_clock::now().time_since_epoch());
- EXPECT_EQ(now, boot_seconds);
-}
-
-} // namespace base
-} // namespace android \ No newline at end of file