util/time: Move NSEC_PER_SEC to header

This constant can be useful whenever one has to deal with timespecs, so
let's move it to the header.
This commit is contained in:
Kenny Levinsen 2024-11-07 10:22:56 +01:00
parent d6b47c3ab0
commit 0d728f96b7
2 changed files with 2 additions and 2 deletions

View File

@ -4,6 +4,8 @@
#include <stdint.h>
#include <time.h>
static const long NSEC_PER_SEC = 1000000000;
/**
* Get the current time, in milliseconds.
*/

View File

@ -3,8 +3,6 @@
#include "util/time.h"
static const long NSEC_PER_SEC = 1000000000;
int64_t timespec_to_msec(const struct timespec *a) {
return (int64_t)a->tv_sec * 1000 + a->tv_nsec / 1000000;
}