Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
21849ef5
Commit
21849ef5
authored
Aug 03, 2017
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(PassiveTimer): небольшая корректировка
parent
5928091b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
PassiveTimer.h
include/PassiveTimer.h
+2
-0
PassiveTimer.cc
src/Timers/PassiveTimer.cc
+1
-1
test_delaytimer.cc
tests/test_delaytimer.cc
+9
-0
No files found.
include/PassiveTimer.h
View file @
21849ef5
...
...
@@ -86,6 +86,8 @@ namespace uniset
* можно с помощью checkTime проверять, не наступило ли нужное время
* \note Если t_msec==WaitUpTime, таймер никогда не сработает
* \note t_msec=0 - таймер сработает сразу
* \todo Можно оптимизировать вызовы проверки таймера, если ввести внутренний флаг, что он уже сработал
* но ещё не был заново переустановлен.
*/
class
PassiveTimer
:
public
UniSetTimer
...
...
src/Timers/PassiveTimer.cc
View file @
21849ef5
...
...
@@ -63,7 +63,7 @@ namespace uniset
// не знаю как по другому
// приходиться делать это через промежуточную переменную
std
::
chrono
::
milliseconds
ms
(
msec
);
t_inner_msec
=
std
::
move
(
ms
);
std
::
swap
(
t_inner_msec
,
ms
);
PassiveTimer
::
reset
();
return
getInterval
();
...
...
tests/test_delaytimer.cc
View file @
21849ef5
...
...
@@ -199,6 +199,15 @@ TEST_CASE("[DelayTimer]: zero time", "[DelayTimer]" )
msleep
(
100
);
REQUIRE
(
pt
.
getCurrent
()
>=
2000
);
// проверка работы при вызове check()
// уже после срабатывания таймера
dt
.
set
(
0
,
100
);
REQUIRE
(
dt
.
check
(
true
)
);
// взводим
REQUIRE
(
dt
.
check
(
false
)
);
// отпускаем..
msleep
(
150
);
REQUIRE_FALSE
(
dt
.
check
(
false
)
);
// к этому моменту уже должен отпустить
}
}
// -----------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment