File: %40m..%40slib%40sstd%40smonotimes.nim.c

package info (click to toggle)
nim 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,911,644 kB
  • sloc: sh: 24,603; ansic: 1,761; python: 1,492; makefile: 1,013; sql: 298; asm: 141; xml: 13
file content (98 lines) | stat: -rw-r--r-- 3,841 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* Generated by Nim Compiler v2.2.0 */
#define NIM_INTBITS 32

#include "nimbase.h"
#include <string.h>
#include <time.h>
#include <sys/types.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
typedef struct tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg;
typedef struct tyObject_Duration__jAw0SyQ4ug9awOiI2XrxEhg tyObject_Duration__jAw0SyQ4ug9awOiI2XrxEhg;
struct tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg {
	NI64 ticks;
};
struct tyObject_Duration__jAw0SyQ4ug9awOiI2XrxEhg {
	NI64 seconds;
	NI nanosecond;
};
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1);
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(NI64, inNanoseconds__pureZtimes_u876)(tyObject_Duration__jAw0SyQ4ug9awOiI2XrxEhg dur_p0);
N_LIB_PRIVATE N_NIMCALL(tyObject_Duration__jAw0SyQ4ug9awOiI2XrxEhg, initDuration__pureZtimes_u487)(NI64 nanoseconds_p0, NI64 microseconds_p1, NI64 milliseconds_p2, NI64 seconds_p3, NI64 minutes_p4, NI64 hours_p5, NI64 days_p6, NI64 weeks_p7);
extern NIM_BOOL nimInErrorMode__system_u4310;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (&nimInErrorMode__system_u4310);
	return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg, plus___stdZmonotimes_u37)(tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg a_p0, tyObject_Duration__jAw0SyQ4ug9awOiI2XrxEhg b_p1) {
	tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg result;
	tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg T1_;
	NI64 T2_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimZeroMem((void*)(&result), sizeof(tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg));
	T2_ = (NI64)0;
	T2_ = inNanoseconds__pureZtimes_u876(b_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T1_.ticks = (NI64)(a_p0.ticks + T2_);
	result = T1_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg, getMonoTime__stdZmonotimes_u5)(void) {
	tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg result;
	struct timespec ts;
	int T1_;
	nimZeroMem((void*)(&ts), sizeof(struct timespec));
	T1_ = (int)0;
	T1_ = clock_gettime(((clockid_t) (CLOCK_MONOTONIC)), (&ts));
	(void)(T1_);
	result.ticks = (NI64)((NI64)(((NI64) (ts.tv_sec)) * IL64(1000000000)) + ((NI64) (ts.tv_nsec)));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, lteq___stdZmonotimes_u49)(tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg a_p0, tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg b_p1) {
	NIM_BOOL result;
	result = (a_p0.ticks <= b_p1.ticks);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI64, ticks__stdZmonotimes_u27)(tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg t_p0) {
	NI64 result;
	result = t_p0.ticks;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_Duration__jAw0SyQ4ug9awOiI2XrxEhg, minus___stdZmonotimes_u33)(tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg a_p0, tyObject_MonoTime__gfTIziSaHbUnXL4ibQmWGg b_p1) {
	tyObject_Duration__jAw0SyQ4ug9awOiI2XrxEhg result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimZeroMem((void*)(&result), sizeof(tyObject_Duration__jAw0SyQ4ug9awOiI2XrxEhg));
	result = initDuration__pureZtimes_u487((NI64)(a_p0.ticks - b_p1.ticks), IL64(0), IL64(0), IL64(0), IL64(0), IL64(0), IL64(0), IL64(0));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}