PMDK C++ bindings
1.10
This is the C++ bindings documentation for PMDK's libpmemobj.
Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
m
n
o
p
r
s
t
Functions
a
b
c
d
e
g
m
n
o
p
r
s
t
Typedefs
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
~
Variables
Typedefs
Enumerations
Related Functions
Files
File List
File Members
All
Macros
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Friends
Macros
Pages
libpmemobj++
detail
conversions.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSD-3-Clause
2
/* Copyright 2016-2018, Intel Corporation */
3
9
#ifndef LIBPMEMOBJ_CPP_CONVERSIONS_HPP
10
#define LIBPMEMOBJ_CPP_CONVERSIONS_HPP
11
12
#include <chrono>
13
#include <ctime>
14
15
namespace
pmem
16
{
17
18
namespace
detail
19
{
20
28
template
<
typename
Clock,
typename
Duration =
typename
Clock::duration>
29
timespec
30
timepoint_to_timespec
(
const
std::chrono::time_point<Clock, Duration> &timepoint)
31
{
32
timespec ts;
33
auto
rel_duration = timepoint.time_since_epoch();
34
const
auto
sec =
35
std::chrono::duration_cast<std::chrono::seconds>(rel_duration);
36
37
ts.tv_sec = sec.count();
38
ts.tv_nsec =
static_cast<
long
>
(
39
std::chrono::duration_cast<std::chrono::nanoseconds>(
40
rel_duration - sec)
41
.count());
42
43
return
ts;
44
}
45
46
}
/* namespace detail */
47
48
}
/* namespace pmem */
49
50
#endif
/* LIBPMEMOBJ_CPP_CONVERSIONS_HPP */
pmem::detail::timepoint_to_timespec
timespec timepoint_to_timespec(const std::chrono::time_point< Clock, Duration > &timepoint)
Convert std::chrono::time_point to posix timespec.
Definition:
conversions.hpp:30
pmem
Persistent memory namespace.
Definition:
allocation_flag.hpp:15
Generated by
1.8.20