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
bef5dade
Commit
bef5dade
authored
Sep 07, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(PassiveTimer): исправление ошибки в функции millisecToPoco()
parent
5308b799
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
libuniset2.spec
conf/libuniset2.spec
+4
-1
PassiveTimer.h
include/PassiveTimer.h
+1
-1
PassiveTimer.cc
src/Timers/PassiveTimer.cc
+3
-3
test_passivetimer.cc
tests/test_passivetimer.cc
+3
-4
No files found.
conf/libuniset2.spec
View file @
bef5dade
...
...
@@ -14,7 +14,7 @@
Name: libuniset2
Version: 2.5
Release: alt
9
Release: alt
10
Summary: UniSet - library for building distributed industrial control systems
License: LGPL
...
...
@@ -486,6 +486,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# ..
%changelog
* Wed Sep 07 2016 Pavel Vainerman <pv@altlinux.ru> 2.5-alt10
- fixed bug in millisecToPoco() function
* Tue Sep 06 2016 Pavel Vainerman <pv@altlinux.ru> 2.5-alt9
- (UNetUDP): optimization use mutex
- (unet-udp-tester): add new command line agruments
...
...
include/PassiveTimer.h
View file @
bef5dade
...
...
@@ -65,7 +65,7 @@ class UniSetTimer
*/
static
const
timeout_t
WaitUpTime
=
std
::
numeric_limits
<
timeout_t
>::
max
();
// преобразование
с учётом WaitUpTime, т.к. в Poco::Timespan вечное ожидание это "0" :(
// преобразование
в Poco::Timespan с учётом WaitUpTime
static
const
Poco
::
Timespan
millisecToPoco
(
const
timeout_t
msec
);
static
const
Poco
::
Timespan
microsecToPoco
(
const
timeout_t
usec
);
...
...
src/Timers/PassiveTimer.cc
View file @
bef5dade
...
...
@@ -114,16 +114,16 @@ void UniSetTimer::stop()
const
Poco
::
Timespan
UniSetTimer
::
millisecToPoco
(
const
timeout_t
msec
)
{
if
(
msec
==
WaitUpTime
)
return
Poco
::
Timespan
(
0
,
0
);
return
Poco
::
Timespan
(
Poco
::
Timestamp
::
TIMEVAL_MAX
,
0
);
// msec --> usec
return
Poco
::
Timespan
(
long
(
msec
/
1000
),
long
((
msec
%
1000
)
*
1
000
)
);
return
Poco
::
Timespan
(
long
(
msec
/
1000
),
long
((
msec
*
1000
)
%
1000
000
)
);
}
//------------------------------------------------------------------------------
const
Poco
::
Timespan
UniSetTimer
::
microsecToPoco
(
const
timeout_t
usec
)
{
if
(
usec
==
WaitUpTime
)
return
Poco
::
Timespan
(
0
,
0
);
return
Poco
::
Timespan
(
Poco
::
Timestamp
::
TIMEVAL_MAX
,
0
);
return
Poco
::
Timespan
(
long
(
usec
/
1000000
),
long
(
usec
%
1000000
)
);
}
...
...
tests/test_passivetimer.cc
View file @
bef5dade
...
...
@@ -107,15 +107,14 @@ TEST_CASE("UniSetTimer: conv to Poco", "[PassiveTimer][poco]" )
{
Poco
::
Timespan
tm
=
UniSetTimer
::
millisecToPoco
(
UniSetTimer
::
WaitUpTime
);
REQUIRE
(
tm
.
seconds
()
==
0
);
REQUIRE
(
tm
.
seconds
()
==
-
1
);
REQUIRE
(
tm
.
microseconds
()
==
0
);
}
{
Poco
::
Timespan
tm
=
UniSetTimer
::
millisecToPoco
(
20
);
REQUIRE
(
tm
.
seconds
()
==
0
);
REQUIRE
(
tm
.
milliseconds
()
==
20
);
REQUIRE
(
tm
.
microseconds
()
==
0
);
REQUIRE
(
tm
.
totalMilliseconds
()
==
20
);
REQUIRE
(
tm
.
totalMicroseconds
()
==
20000
);
}
...
...
@@ -123,7 +122,7 @@ TEST_CASE("UniSetTimer: conv to Poco", "[PassiveTimer][poco]" )
// usec --> Poco::Timespan
{
Poco
::
Timespan
tm
=
UniSetTimer
::
microsecToPoco
(
UniSetTimer
::
WaitUpTime
);
REQUIRE
(
tm
.
seconds
()
==
0
);
REQUIRE
(
tm
.
seconds
()
==
-
1
);
REQUIRE
(
tm
.
microseconds
()
==
0
);
}
{
...
...
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