src/njs_md5.c \
src/njs_sha1.c \
src/njs_sha2.c \
- src/njs_time.c \
src/njs_malloc.c \
src/njs_mp.c \
src/njs_sprintf.c \
#include <njs.h>
#include <njs_unix.h>
-#include <njs_time.h>
#include <njs_arr.h>
#include <njs_queue.h>
#include <njs_rbtree.h>
static intptr_t njs_event_rbtree_compare(njs_rbtree_node_t *node1,
njs_rbtree_node_t *node2);
+static uint64_t njs_time(void);
njs_int_t njs_array_buffer_detach(njs_vm_t *vm, njs_value_t *args,
njs_uint_t nargs, njs_index_t unused, njs_value_t *retval);
return 0;
}
+
+
+static uint64_t
+njs_time(void)
+{
+#if (NJS_HAVE_CLOCK_MONOTONIC)
+ struct timespec ts;
+
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+
+ return (uint64_t) ts.tv_sec * 1000000000 + ts.tv_nsec;
+#else
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+
+ return (uint64_t) tv.tv_sec * 1000000000 + tv.tv_usec * 1000;
+#endif
+}
#define NJS_DATE_MSEC 7
+#if (NJS_HAVE_TM_GMTOFF)
+
+#define njs_timezone(tm) \
+ ((tm)->tm_gmtoff)
+
+#elif (NJS_HAVE_ALTZONE)
+
+#define njs_timezone(tm) \
+ (-(((tm)->tm_isdst > 0) ? altzone : timezone))
+
+#endif
+
+
#define njs_date_magic(field, local) \
((local << 6) + field)
#include <njs_queue.h>
#include <njs_flathsh.h>
#include <njs_random.h>
-#include <njs_time.h>
#include <njs_malloc.h>
#include <njs_rbtree.h>
#include <njs_mp.h>
+++ /dev/null
-
-/*
- * Copyright (C) Igor Sysoev
- * Copyright (C) NGINX, Inc.
- */
-
-
-#include <njs_main.h>
-
-
-uint64_t
-njs_time(void)
-{
-#if (NJS_HAVE_CLOCK_MONOTONIC)
- struct timespec ts;
-
- clock_gettime(CLOCK_MONOTONIC, &ts);
-
- return (uint64_t) ts.tv_sec * 1000000000 + ts.tv_nsec;
-#else
- struct timeval tv;
-
- gettimeofday(&tv, NULL);
-
- return (uint64_t) tv.tv_sec * 1000000000 + tv.tv_usec * 1000;
-#endif
-}
+++ /dev/null
-
-/*
- * Copyright (C) Igor Sysoev
- * Copyright (C) NGINX, Inc.
- */
-
-#ifndef _NJS_TIME_H_INCLUDED_
-#define _NJS_TIME_H_INCLUDED_
-
-
-#if (NJS_HAVE_TM_GMTOFF)
-
-#define njs_timezone(tm) \
- ((tm)->tm_gmtoff)
-
-#elif (NJS_HAVE_ALTZONE)
-
-#define njs_timezone(tm) \
- (-(((tm)->tm_isdst > 0) ? altzone : timezone))
-
-#endif
-
-
-uint64_t njs_time(void);
-
-
-#endif /* _NJS_TIME_H_INCLUDED_ */
};
+static uint64_t
+njs_time(void)
+{
+#if (NJS_HAVE_CLOCK_MONOTONIC)
+ struct timespec ts;
+
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+
+ return (uint64_t) ts.tv_sec * 1000000000 + ts.tv_nsec;
+#else
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+
+ return (uint64_t) tv.tv_sec * 1000000000 + tv.tv_usec * 1000;
+#endif
+}
+
+
static njs_int_t
njs_benchmark_test(njs_vm_t *parent, njs_opts_t *opts, njs_value_t *report,
njs_benchmark_test_t *test)