mirror of
https://github.com/carp-lang/Carp.git
synced 2024-11-05 04:44:12 +03:00
43 lines
628 B
C
43 lines
628 B
C
|
|
void System_free(void *p) {
|
|
CARP_FREE(p);
|
|
}
|
|
|
|
int System_time() {
|
|
return time(0);
|
|
}
|
|
|
|
#ifdef _WIN32
|
|
void System_sleep_MINUS_seconds(int t) {
|
|
// TODO!
|
|
}
|
|
|
|
void System_sleep_MINUS_micros(int t) {
|
|
// TODO!
|
|
}
|
|
|
|
double System_nanotime() {
|
|
return 0;
|
|
}
|
|
#else
|
|
void System_sleep_MINUS_seconds(int t) {
|
|
sleep(t);
|
|
}
|
|
|
|
void System_sleep_MINUS_micros(int t) {
|
|
usleep(t);
|
|
}
|
|
|
|
double System_nanotime() {
|
|
struct timespec tv;
|
|
clock_gettime(CLOCK_REALTIME, &tv);
|
|
return 1000000000 * tv.tv_sec + tv.tv_nsec;
|
|
}
|
|
#endif
|
|
|
|
int System_system(const String *command) {
|
|
return system(*command);
|
|
}
|
|
|
|
Array System_args;
|