2018-02-27 16:14:14 +03:00
|
|
|
#include <time.h>
|
2018-02-27 17:30:22 +03:00
|
|
|
|
|
|
|
#ifndef _WIN32
|
2018-02-27 16:14:14 +03:00
|
|
|
#include <unistd.h>
|
2018-02-27 17:30:22 +03:00
|
|
|
#endif
|
2018-02-27 16:14:14 +03:00
|
|
|
|
|
|
|
#include <carp_memory.h>
|
2018-01-24 17:53:18 +03:00
|
|
|
|
|
|
|
void System_free(void *p) {
|
|
|
|
CARP_FREE(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
int System_time() {
|
|
|
|
return time(0);
|
|
|
|
}
|
|
|
|
|
2018-02-27 16:54:34 +03:00
|
|
|
void System_seed_MINUS_random(int x) {
|
2018-01-24 17:53:18 +03:00
|
|
|
srand(x);
|
|
|
|
}
|
|
|
|
|
2018-02-27 17:30:22 +03:00
|
|
|
#ifndef _WIN32
|
2018-01-24 17:53:18 +03:00
|
|
|
void System_sleep_MINUS_seconds(int t) {
|
|
|
|
sleep(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
void System_sleep_MINUS_micros(int t) {
|
|
|
|
usleep(t);
|
|
|
|
}
|
2018-02-27 17:30:22 +03:00
|
|
|
#endif
|
2018-01-24 17:53:18 +03:00
|
|
|
|
2018-02-27 16:49:06 +03:00
|
|
|
int Int_random() {
|
|
|
|
return rand();
|
|
|
|
}
|
|
|
|
|
|
|
|
int Int_random_MINUS_between(int lower, int upper) {
|
|
|
|
int diff = upper - lower;
|
|
|
|
return lower + (rand() % diff);
|
|
|
|
}
|
2018-03-11 16:53:50 +03:00
|
|
|
|
2018-03-18 16:53:03 +03:00
|
|
|
void System_system(String *command) {
|
2018-03-11 16:53:50 +03:00
|
|
|
system(*command);
|
|
|
|
}
|