From d730dd15737042f0ebfc817a42e52569a9bc11ef Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Fri, 27 Aug 2021 11:48:06 +0200 Subject: [PATCH] Fix timestamp math for platforms without _POSIX_MONOTONIC_CLOCK Pretty much a rebase https://github.com/tmm1/stackprof/pull/122 --- ext/stackprof/stackprof.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/stackprof/stackprof.c b/ext/stackprof/stackprof.c index 98d48572..06b40679 100644 --- a/ext/stackprof/stackprof.c +++ b/ext/stackprof/stackprof.c @@ -69,7 +69,7 @@ static const char *fake_frame_cstrs[] = { static int64_t delta_usec(timestamp_t *start, timestamp_t *end) { struct timeval diff; timersub(end, start, &diff); - return (1000 * diff.tv_sec) + diff.tv_usec; + return (MICROSECONDS_IN_SECOND * diff.tv_sec) + diff.tv_usec; } #endif