diff --git a/test/test-hrtime.c b/test/test-hrtime.c index 03cb429d..9256b80a 100644 --- a/test/test-hrtime.c +++ b/test/test-hrtime.c @@ -23,6 +23,16 @@ #include "task.h" +#ifndef MICROSEC +# define MICROSEC 1000000 +#endif + +#ifndef NANOSEC +# define NANOSEC 1000000000 +#endif + + + /* * We expect the amount of time passed to be at least one us plus two system * calls. Therefore checking that at least a microsecond has elapsed is safe. diff --git a/uv.h b/uv.h index a013c8d2..1cd8eede 100644 --- a/uv.h +++ b/uv.h @@ -459,6 +459,18 @@ struct sockaddr_in6 uv_ip6_addr(const char* ip, int port); /* Gets the executable path */ int uv_exepath(char* buffer, size_t* size); +/* + * Returns the current high-resolution real time. This is expressed in + * nanoseconds. It is relative to an arbitrary time in the past. It is not + * related to the time of day and therefore not subject to clock drift. The + * primary use is for measuring performance between intervals. + * + * Note not every platform can support nanosecond resolution; however, this + * value will always be in nanoseconds. + */ +extern uint64_t uv_hrtime(void); + + /* the presence of this union forces similar struct layout */ union uv_any_handle { uv_tcp_t tcp; @@ -486,35 +498,6 @@ typedef struct { uv_counters_t* uv_counters(); - -#ifndef SEC -# define SEC 1 -#endif - -#ifndef MILLISEC -# define MILLISEC 1000 -#endif - -#ifndef MICROSEC -# define MICROSEC 1000000 -#endif - -#ifndef NANOSEC -# define NANOSEC 1000000000 -#endif - - -/* - * Returns the current high-resolution real time. This is expressed in - * nanoseconds. It is relative to an arbitrary time in the past. It is not - * related to the time of day and therefore not subject to clock drift. The - * primary use is for measuring performance between intervals. - * - * Note not every platform can support nanosecond resolution; however, this - * value will always be in nanoseconds. - */ -extern uint64_t uv_hrtime(void); - #ifdef __cplusplus } #endif