YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
system_clock.cpp
Go to the documentation of this file.
1
#include <
yaclib/fault/detail/fiber/system_clock.hpp
>
2
3
namespace
yaclib::detail::fiber
{
4
5
SystemClock::time_point
SystemClock::now
() {
6
return
time_point
{
duration
{
fault::Scheduler::GetScheduler
()->
GetTimeNs
()}};
7
}
8
9
time_t
SystemClock::to_time_t
(
const
SystemClock::time_point
&
time_point
)
noexcept
{
10
return
static_cast<
std::time_t
>
(
11
std::chrono::duration_cast<std::chrono::seconds>(
time_point
.time_since_epoch()).count());
12
}
13
14
SystemClock::time_point
SystemClock::from_time_t
(
time_t
c_time_point
)
noexcept
{
15
return
std::chrono::time_point_cast<SystemClock::duration>(
16
std::chrono::time_point<SystemClock, std::chrono::seconds>(std::chrono::seconds(
c_time_point
)));
17
}
18
19
}
// namespace yaclib::detail::fiber
yaclib::fault::Scheduler::GetTimeNs
std::uint64_t GetTimeNs() const noexcept
Definition
scheduler.cpp:67
yaclib::fault::Scheduler::GetScheduler
static Scheduler * GetScheduler() noexcept
Definition
scheduler.cpp:30
yaclib::detail::fiber
Definition
atomic.hpp:7
yaclib::MakeContract
Contract< V, E > MakeContract()
Creates related future and promise.
Definition
contract.hpp:25
yaclib::detail::fiber::SystemClock::duration
std::chrono::nanoseconds duration
Definition
system_clock.hpp:10
yaclib::detail::fiber::SystemClock::time_point
std::chrono::time_point< SystemClock > time_point
Definition
system_clock.hpp:13
yaclib::detail::fiber::SystemClock::to_time_t
static time_t to_time_t(const time_point &time_point) noexcept
Definition
system_clock.cpp:9
yaclib::detail::fiber::SystemClock::now
static time_point now()
Definition
system_clock.cpp:5
yaclib::detail::fiber::SystemClock::from_time_t
static time_point from_time_t(time_t c_time_point) noexcept
Definition
system_clock.cpp:14
system_clock.hpp
src
fault
fiber
system_clock.cpp
Generated by
1.9.8