11#ifndef EEL_MISC_NO_SLEEP
17 if (*amt > 30000000.0)
Sleep(30000000);
20 if (*amt > 30000000.0) usleep(((useconds_t)30000000)*1000);
21 else usleep((useconds_t)(*amt*1000.0+0.5));
30 *
v = (EEL_F) time(
NULL);
37 LARGE_INTEGER
freq,now;
38 QueryPerformanceFrequency(&
freq);
39 QueryPerformanceCounter(&now);
40 *
v = (double)now.QuadPart / (
double)
freq.QuadPart;
46 struct timeval tm={0,};
48 gettimeofday(&tm,
NULL);
49 *
v = tm.tv_sec + tm.tv_usec*0.000001;
57#ifndef EEL_MISC_NO_SLEEP
64#ifdef EEL_WANT_DOCUMENTATION
65static const char *eel_misc_function_reference =
66#ifndef EEL_MISC_NO_SLEEP
67 "sleep\tms\tYields the CPU for the millisecond count specified, calling Sleep() on Windows or usleep() on other platforms.\0"
69 "time\t[&val]\tSets the parameter (or a temporary buffer if omitted) to the number of seconds since January 1, 1970, and returns a reference to that value. "
70 "The granularity of the value returned is 1 second.\0"
71 "time_precise\t[&val]\tSets the parameter (or a temporary buffer if omitted) to a system-local timestamp in seconds, and returns a reference to that value. "
72 "The granularity of the value returned is system defined (but generally significantly smaller than one second).\0"
unsigned v[N_MAX]
Definition inflate.c:1584
#define NSEEL_addfunc_retptr(name, np, pproc, fptr)
Definition eel_import.h:55
#define NSEEL_addfunc_retval(name, np, pproc, fptr)
Definition eel_import.h:51
void *(* NSEEL_PProc_THIS)(void *data, int data_size, struct _compileContext *ctx)
Definition eel_import.h:40
void EEL_misc_register()
Definition eel_misc.h:55
static EEL_F *NSEEL_CGEN_CALL _eel_time_precise(void *opaque, EEL_F *v)
Definition eel_misc.h:34
static EEL_F NSEEL_CGEN_CALL _eel_sleep(void *opaque, EEL_F *amt)
Definition eel_misc.h:12
static EEL_F *NSEEL_CGEN_CALL _eel_time(void *opaque, EEL_F *v)
Definition eel_misc.h:28
#define opaque
Definition eelscript.h:281
JHUFF_TBL long freq[]
Definition jchuff.h:50
#define NSEEL_CGEN_CALL
Definition ns-eel.h:44
unsigned int DWORD
Definition swell-types.h:164
void Sleep(int ms)
Definition swell.cpp:63