Carp/core/carp_system.h

42 lines
627 B
C
Raw Normal View History

void System_free(void *p) {
CARP_FREE(p);
}
2018-01-24 17:53:18 +03:00
int System_time() {
return time(0);
}
2018-01-24 17:53:18 +03:00
2019-03-05 17:03:18 +03:00
#ifdef _WIN32
void System_sleep_MINUS_seconds(int t) {
// TODO!
}
void System_sleep_MINUS_micros(int t) {
// TODO!
}
double System_nanotime() {
return 0;
}
2019-03-05 17:03:18 +03:00
#else
void System_sleep_MINUS_seconds(int t) {
sleep(t);
}
2018-01-24 17:53:18 +03:00
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;
}
2019-03-05 17:03:18 +03:00
#endif
int System_system(const String *command) {
return system(*command);
}
2018-04-04 10:00:20 +03:00
Array System_args;