From 8f96be6ca60d967bd4b37f93d0a03bcff4145200 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 2 Aug 2018 10:08:43 -0700 Subject: Export of internal Abseil changes. -- 586c41e29e80d9613434f18347d4a70a92a90989 by Jon Cohen : Whitespace cleanup PiperOrigin-RevId: 207119388 -- e28fc6932d68f7097918f3092079f07112e684c1 by Abseil Team : Fix comment typo in mutex.h PiperOrigin-RevId: 207024211 -- b7714a5f189b2863f9cfc285ba428ca2059b83f4 by Abseil Team : Raise the floor for gcc from gcc 4.7 to gcc 4.8. PiperOrigin-RevId: 207021220 -- 262ae79150278ea1b4e512dfe8ff05c32768f429 by Matt Armstrong : Raise the floor for gcc from gcc 4.7 to gcc 4.8. PiperOrigin-RevId: 206997741 -- 5aba0b15eaf6c5beff0e91670a7cdf5ad1151886 by Derek Mauro : Use std::chrono to get the current time on both Apple and Windows platforms, eliminating the unnecessarily complicated logic on Apple platforms. PiperOrigin-RevId: 206979219 -- 807a91adf876f7532050d442f00268754c0f260b by Derek Mauro : Fix multiple definition problem when Abseil is combined with gperftools on PowerPC. https://github.com/abseil/abseil-cpp/pull/152 PiperOrigin-RevId: 206963083 GitOrigin-RevId: 586c41e29e80d9613434f18347d4a70a92a90989 Change-Id: I0ee65a733c423890b97dd3500f2d17449792387c --- absl/time/internal/get_current_time_chrono.inc | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 absl/time/internal/get_current_time_chrono.inc (limited to 'absl/time/internal/get_current_time_chrono.inc') diff --git a/absl/time/internal/get_current_time_chrono.inc b/absl/time/internal/get_current_time_chrono.inc new file mode 100644 index 000000000000..cf884a10ed9d --- /dev/null +++ b/absl/time/internal/get_current_time_chrono.inc @@ -0,0 +1,29 @@ +// Copyright 2018 The Abseil Authors. +// +// 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 +#include + +namespace absl { +namespace time_internal { + +static int64_t GetCurrentTimeNanosFromSystem() { + return std::chrono::duration_cast( + std::chrono::system_clock::now() - + std::chrono::system_clock::from_time_t(0)) + .count(); +} + +} // namespace time_internal +} // namespace absl -- cgit 1.4.1