unix, test: make NANOSEC a 64 bits unsigned int

Avoids accidental overflow / truncation when it's used in 32 bits arithmetic.
This commit is contained in:
Ben Noordhuis 2012-06-07 15:40:14 +02:00
parent e2aa39aecf
commit 59cda86709
7 changed files with 7 additions and 7 deletions

View File

@ -29,7 +29,7 @@
#include <time.h>
#undef NANOSEC
#define NANOSEC 1000000000
#define NANOSEC ((uint64_t) 1e9)
uint64_t uv_hrtime() {

View File

@ -38,7 +38,7 @@
#include <fcntl.h>
#undef NANOSEC
#define NANOSEC 1000000000
#define NANOSEC ((uint64_t) 1e9)
#ifndef CPUSTATES
# define CPUSTATES 5U

View File

@ -46,7 +46,7 @@
#endif
#undef NANOSEC
#define NANOSEC 1000000000
#define NANOSEC ((uint64_t) 1e9)
/* This is rather annoying: CLOCK_BOOTTIME lives in <linux/time.h> but we can't
* include that file because it conflicts with <time.h>. We'll just have to

View File

@ -32,7 +32,7 @@
#include <time.h>
#undef NANOSEC
#define NANOSEC 1000000000
#define NANOSEC ((uint64_t) 1e9)
uint64_t uv_hrtime(void) {

View File

@ -37,7 +37,7 @@
#include <unistd.h>
#undef NANOSEC
#define NANOSEC 1000000000
#define NANOSEC ((uint64_t) 1e9)
static char *process_title;

View File

@ -26,7 +26,7 @@
#define MAX_CONNS 1000
#undef NANOSEC
#define NANOSEC ((uint64_t)10e8)
#define NANOSEC ((uint64_t) 1e9)
#undef DEBUG
#define DEBUG 0

View File

@ -27,7 +27,7 @@
#endif
#ifndef NANOSEC
# define NANOSEC 1000000000
# define NANOSEC ((uint64_t) 1e9)
#endif