Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
UERANSIM
Commits
17a4f08f
Commit
17a4f08f
authored
Feb 27, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CLI NAS timer improvement
parent
141bb7f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
src/nas/timer.cpp
src/nas/timer.cpp
+12
-11
No files found.
src/nas/timer.cpp
View file @
17a4f08f
...
...
@@ -8,6 +8,7 @@
#include "timer.hpp"
#include <sstream>
#include <utils/common.hpp>
namespace
nas
...
...
@@ -96,16 +97,16 @@ bool NasTimer::performTick()
if
(
running
)
{
long
currentMs
=
utils
::
CurrentTimeMillis
();
long
deltaSec
=
(
currentMs
-
startMillis
)
/
1000
;
long
deltaSec
=
(
currentMs
-
startMillis
)
/
1000
LL
;
long
remainingSec
=
interval
-
deltaSec
;
if
(
currentMs
-
_lastDebugPrintMs
>
10
*
1000
)
if
(
currentMs
-
_lastDebugPrintMs
>
10
LL
*
1000LL
)
{
_lastDebugPrintMs
=
currentMs
;
// Log.debug(Tag.TIMER, "NAS Timer %s int:%ss rem:%ss", timerCode, interval, remainingSec);
}
if
(
remainingSec
<
0
)
if
(
remainingSec
<
=
0LL
)
{
stop
(
false
);
expiryCount
++
;
...
...
@@ -125,8 +126,8 @@ int NasTimer::getRemaining() const
if
(
!
running
)
return
0
;
long
elapsed
=
utils
::
CurrentTimeMillis
()
-
startMillis
;
return
st
atic_cast
<
int
>
(
std
::
max
(
interval
-
elapsed
,
0L
)
);
int
elapsed
=
static_cast
<
int
>
((
utils
::
CurrentTimeMillis
()
-
startMillis
)
/
1000LL
)
;
return
st
d
::
max
(
interval
-
elapsed
,
0
);
}
void
NasTimer
::
resetExpiryCount
()
...
...
@@ -141,13 +142,13 @@ int NasTimer::getExpiryCount() const
Json
ToJson
(
const
NasTimer
&
v
)
{
int
interval
=
v
.
getInterval
();
std
::
stringstream
ss
{};
if
(
v
.
isRunning
())
ss
<<
"rem["
<<
v
.
getRemaining
()
<<
"] int["
<<
v
.
getInterval
()
<<
"]"
;
else
ss
<<
"."
;
return
Json
::
Obj
({
{
"interval"
,
interval
==
INT32_MAX
?
Json
{
"inf"
}
:
interval
},
{
"remaining"
,
v
.
getRemaining
()},
{
"running"
,
v
.
isRunning
()},
});
return
ss
.
str
();
}
}
// namespace nas
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