Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libnrm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
argo
libnrm
Commits
ce73ba1c
Commit
ce73ba1c
authored
Dec 05, 2018
by
Valentin Reis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using CLOCK_MONOTONIC
parent
b46302e2
Pipeline
#4555
failed with stages
in 3 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
src/downstream_api.c
src/downstream_api.c
+6
-6
src/nrm.h
src/nrm.h
+1
-1
No files found.
src/downstream_api.c
View file @
ce73ba1c
...
...
@@ -36,7 +36,7 @@ int nrm_init(struct nrm_context *ctxt, const char *uuid)
sleep
(
1
);
err
=
zmq_send
(
ctxt
->
socket
,
buf
,
strnlen
(
buf
,
512
),
0
);
assert
(
err
>
0
);
assert
(
!
clock_gettime
(
CLOCK_
REALTIME
,
&
ctxt
->
time
));
assert
(
!
clock_gettime
(
CLOCK_
MONOTONIC
,
&
ctxt
->
time
));
ctxt
->
acc
=
0
;
return
0
;
}
...
...
@@ -57,7 +57,7 @@ int nrm_send_progress(struct nrm_context *ctxt, unsigned long progress)
{
char
buf
[
512
];
struct
timespec
now
;
clock_gettime
(
CLOCK_
REALTIME
,
&
now
);
clock_gettime
(
CLOCK_
MONOTONIC
,
&
now
);
long
long
int
timediff
=
(
now
.
tv_nsec
-
ctxt
->
time
.
tv_nsec
)
+
1e9
*
(
now
.
tv_sec
-
ctxt
->
time
.
tv_sec
);
ctxt
->
acc
+=
progress
;
...
...
@@ -78,7 +78,7 @@ int nrm_send_phase_context(struct nrm_context *ctxt, unsigned int cpu, unsigned
{
char
buf
[
512
];
struct
timespec
now
;
clock_gettime
(
CLOCK_
REALTIME
,
&
now
);
clock_gettime
(
CLOCK_
MONOTONIC
,
&
now
);
long
long
int
timediff
=
(
now
.
tv_nsec
-
ctxt
->
time
.
tv_nsec
)
+
1e9
*
(
now
.
tv_sec
-
ctxt
->
time
.
tv_sec
);
...
...
src/nrm.h
View file @
ce73ba1c
...
...
@@ -50,7 +50,7 @@ int nrm_send_phase_context(struct nrm_context *ctxt,
inline
long
long
int
nrm_gettime
(
void
)
{
struct
timespec
now
;
clock_gettime
(
CLOCK_
REALTIME
,
&
now
);
clock_gettime
(
CLOCK_
MONOTONIC
,
&
now
);
return
((
now
.
tv_sec
*
1e9
)
+
now
.
tv_nsec
);
}
...
...
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