Commit ce73ba1c authored by Valentin Reis's avatar Valentin Reis

Using CLOCK_MONOTONIC

parent b46302e2
Pipeline #4555 failed with stages
in 3 seconds
...@@ -36,7 +36,7 @@ int nrm_init(struct nrm_context *ctxt, const char *uuid) ...@@ -36,7 +36,7 @@ int nrm_init(struct nrm_context *ctxt, const char *uuid)
sleep(1); sleep(1);
err = zmq_send(ctxt->socket, buf, strnlen(buf, 512), 0); err = zmq_send(ctxt->socket, buf, strnlen(buf, 512), 0);
assert(err > 0); assert(err > 0);
assert(!clock_gettime(CLOCK_REALTIME, &ctxt->time)); assert(!clock_gettime(CLOCK_MONOTONIC, &ctxt->time));
ctxt->acc = 0; ctxt->acc = 0;
return 0; return 0;
} }
...@@ -57,7 +57,7 @@ int nrm_send_progress(struct nrm_context *ctxt, unsigned long progress) ...@@ -57,7 +57,7 @@ int nrm_send_progress(struct nrm_context *ctxt, unsigned long progress)
{ {
char buf[512]; char buf[512];
struct timespec now; struct timespec now;
clock_gettime(CLOCK_REALTIME, &now); clock_gettime(CLOCK_MONOTONIC, &now);
long long int timediff = (now.tv_nsec - ctxt->time.tv_nsec) + long long int timediff = (now.tv_nsec - ctxt->time.tv_nsec) +
1e9* (now.tv_sec - ctxt->time.tv_sec); 1e9* (now.tv_sec - ctxt->time.tv_sec);
ctxt->acc += progress; ctxt->acc += progress;
...@@ -78,7 +78,7 @@ int nrm_send_phase_context(struct nrm_context *ctxt, unsigned int cpu, unsigned ...@@ -78,7 +78,7 @@ int nrm_send_phase_context(struct nrm_context *ctxt, unsigned int cpu, unsigned
{ {
char buf[512]; char buf[512];
struct timespec now; struct timespec now;
clock_gettime(CLOCK_REALTIME, &now); clock_gettime(CLOCK_MONOTONIC, &now);
long long int timediff = (now.tv_nsec - ctxt->time.tv_nsec) + long long int timediff = (now.tv_nsec - ctxt->time.tv_nsec) +
1e9* (now.tv_sec - ctxt->time.tv_sec); 1e9* (now.tv_sec - ctxt->time.tv_sec);
......
...@@ -50,7 +50,7 @@ int nrm_send_phase_context(struct nrm_context *ctxt, ...@@ -50,7 +50,7 @@ int nrm_send_phase_context(struct nrm_context *ctxt,
inline long long int nrm_gettime(void) inline long long int nrm_gettime(void)
{ {
struct timespec now; struct timespec now;
clock_gettime(CLOCK_REALTIME, &now); clock_gettime(CLOCK_MONOTONIC, &now);
return ((now.tv_sec * 1e9) + now.tv_nsec); return ((now.tv_sec * 1e9) + now.tv_nsec);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment