FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
knowrob/src/TimeInterval.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
/
TimeInterval.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
44 lines (35 loc) · 1.2 KB
Breadcrumbs
knowrob
/
src
/
TimeInterval.cpp
Copy path
File metadata and controls
44 lines (35 loc) · 1.2 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* This file is part of KnowRob, please consult
* https://github.com/knowrob/knowrob for license details.
*/
#
include
"
knowrob/TimeInterval.h
"
using
namespace
knowrob
;
TimeInterval::TimeInterval
(
const
std::optional<TimePoint> &since,
const
std::optional<TimePoint> &until)
: since_(since),
until_(until) {}
bool
TimeInterval::
operator
==(
const
TimeInterval &other)
const
{
return
since_ == other.
since_
&& until_ == other.
until_
;
}
const
TimeInterval &
TimeInterval::anytime
() {
static
const
TimeInterval
timeInterval
(std::
nullopt
, std::
nullopt
);
return
timeInterval;
}
TimeInterval
TimeInterval::currently
() {
TimePoint now =
time::now
();
return
{now, now};
}
TimeInterval
TimeInterval::during
(
const
TimePoint &begin,
const
TimePoint &end) {
return
{begin, end};
}
std::shared_ptr<TimeInterval>
TimeInterval::intersectWith
(
const
TimeInterval &other)
const
{
return
std::make_shared<TimeInterval>(
std::max
(since_, other.
since_
),
std::min
(until_, other.
until_
));
}
void
TimeInterval::write
(std::ostream &os)
const
{
os <<
'
[
'
;
if
(
since
().
has_value
())
time::write
(
since
().
value
(), os);
else
os <<
'
_
'
;
os <<
"
,
"
;
if
(
until
().
has_value
())
time::write
(
until
().
value
(), os);
else
os <<
'
_
'
;
os <<
'
]
'
;
}
Back
|
FazBrowse Home
|
New Git URL