Carp/core/carp_system.h
2020-08-24 11:20:52 +02:00

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;