CCF
Loading...
Searching...
No Matches
time_updater.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the Apache 2.0 License.
3#pragma once
4
5#include "timer.h"
6
7#include <atomic>
8#include <chrono>
9
10namespace asynchost
11{
13 {
14 std::atomic<long long> time_now_us;
15
16 public:
18 {
19 on_timer();
20 }
21
22 std::atomic<long long>* get_value()
23 {
24 return &time_now_us;
25 }
26
27 void on_timer()
28 {
29 using TClock = std::chrono::system_clock;
30 time_now_us = std::chrono::duration_cast<std::chrono::microseconds>(
31 TClock::now().time_since_epoch())
32 .count();
33 }
34 };
35
37}
Definition time_updater.h:13
TimeUpdaterImpl()
Definition time_updater.h:17
void on_timer()
Definition time_updater.h:27
std::atomic< long long > * get_value()
Definition time_updater.h:22
Definition proxy.h:50
Definition after_io.h:8