move nsTime to its own file

This commit is contained in:
dzaima 2021-12-29 19:49:16 +02:00
parent 81a47f1386
commit d68e278083
8 changed files with 19 additions and 8 deletions

View File

@ -1,6 +1,7 @@
#include "../core.h"
#include "../utils/each.h"
#include "../utils/file.h"
#include "../utils/time.h"
#include "../builtins.h"

View File

@ -8,6 +8,7 @@
#include "../utils/file.h"
#include "../utils/wyhash.h"
#include "../utils/mut.h"
#include "../utils/time.h"
#include "../builtins.h"
#include "../ns.h"
#include "../nfns.h"

View File

@ -611,11 +611,3 @@ static B m_fork(B f, B g, B h);
static B m_atop( B g, B h);
#include <time.h>
static inline u64 nsTime() {
struct timespec t;
// timespec_get(&t, TIME_UTC); // doesn't seem to exist on Android
clock_gettime(CLOCK_REALTIME, &t);
return (u64)(t.tv_sec*1000000000ll + t.tv_nsec);
}

View File

@ -3,6 +3,7 @@
#include "ns.h"
#include "utils/utf.h"
#include "utils/file.h"
#include "utils/time.h"
static B replPath;
static Scope* gsc;

View File

@ -1,4 +1,9 @@
#include "gc.h"
#ifdef LOG_GC
#include "../utils/time.h"
#endif
u64 gc_depth = 1;

View File

@ -3,6 +3,7 @@
#ifdef RT_PERF
#include "builtins.h"
#endif
#include "utils/time.h"
#ifdef RT_WRAP
typedef struct WFun WFun;

View File

@ -1,5 +1,6 @@
#include "../core.h"
#include "hash.h"
#include "time.h"
u64 wy_secret[4];

9
src/utils/time.h Normal file
View File

@ -0,0 +1,9 @@
#pragma once
#include <time.h>
static inline u64 nsTime() {
struct timespec t;
// timespec_get(&t, TIME_UTC); // doesn't seem to exist on Android
clock_gettime(CLOCK_REALTIME, &t);
return (u64)(t.tv_sec*1000000000ll + t.tv_nsec);
}