btolsch | 5292c94 | 2018-07-26 00:06:22 -0700 | [diff] [blame] | 1 | // Copyright 2018 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
btolsch | 9d6900c | 2018-05-30 18:22:53 -0700 | [diff] [blame] | 5 | #include "platform/api/time.h" |
| 6 | |
| 7 | #include <chrono> |
| 8 | |
| 9 | namespace openscreen { |
| 10 | namespace platform { |
| 11 | |
btolsch | 5292c94 | 2018-07-26 00:06:22 -0700 | [diff] [blame] | 12 | TimeDelta GetMonotonicTimeNow() { |
| 13 | return TimeDelta::FromMicroseconds( |
| 14 | std::chrono::duration_cast<std::chrono::microseconds>( |
| 15 | std::chrono::steady_clock::now().time_since_epoch()) |
| 16 | .count()); |
| 17 | } |
| 18 | |
| 19 | TimeDelta GetUTCNow() { |
| 20 | return GetMonotonicTimeNow(); |
btolsch | 9d6900c | 2018-05-30 18:22:53 -0700 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | } // namespace platform |
| 24 | } // namespace openscreen |