FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
knowrob/src/TimePoint.cpp at dev · knowrob/knowrob · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
knowrob
/
knowrob
Public
Notifications
You must be signed in to change notification settings
Fork
112
Star
159
Code
Issues
4
Pull requests
2
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
knowrob
/
src
/
TimePoint.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
30 lines (24 loc) · 798 Bytes
Breadcrumbs
knowrob
/
src
/
TimePoint.cpp
Copy path
File metadata and controls
30 lines (24 loc) · 798 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
* This file is part of KnowRob, please consult
* https://github.com/knowrob/knowrob for license details.
*/
#
include
<
chrono
>
#
include
<
cmath
>
#
include
"
knowrob/TimePoint.h
"
using
namespace
knowrob
;
TimePoint
time::now
() {
auto
tp =
std::chrono::system_clock::now
();
return
std::chrono::time_point_cast<std::chrono::seconds>(tp);
}
TimePoint
time::fromSeconds
(
double
seconds) {
auto
tp =
std::chrono::system_clock::from_time_t
(
static_cast
<
time_t
>(seconds));
return
std::chrono::time_point_cast<std::chrono::seconds>(tp);
}
double
time::toSeconds
(
const
TimePoint ×tamp) {
auto
time_t_value =
std::chrono::system_clock::to_time_t
(timestamp);
return
static_cast
<
double
>(time_t_value);
}
void
time::write
(
const
TimePoint &tp, std::ostream &os) {
os <<
time::toSeconds
(tp);
}
Back
|
FazBrowse Home
|
New Git URL