dernier commit avant le Gers

This commit is contained in:
tTh
2024-03-11 02:20:47 +01:00
parent c5b0e17bbb
commit 0818f87582
9 changed files with 99 additions and 23 deletions

8
code/C/hacks.txt Normal file
View File

@@ -0,0 +1,8 @@
inline int
usleep(useconds_t microseconds)
{
struct timespec ts;
ts.tv_sec = microseconds / (useconds_t)1000000;
ts.tv_nsec = (long)(microseconds % (useconds_t)1000000) * 1000L;
return nanosleep(&ts, NULL);
}

View File

@@ -7,18 +7,20 @@ int main(int argc, char *argv[])
{
int c, sec, nano;
struct timespec ts;
int slowdown = 300; /* set a default value */
int slowdown = 300; /* set a default value */
float delay;
/*
* get the desired slowdown from command-line
*/
if (2 == argc) {
if (1 != sscanf(argv[1], "%d", &slowdown)) {
fprintf(stderr, "%s: bad arg, sorry\n", argv[0]);
fprintf(stderr, "%s: bad arg, sorry\n",
argv[0]);
exit(1);
}
if (slowdown < 1) {
fprintf(stderr, "%d is invalid\n", slowdown);
fprintf(stderr, "%d is invalid\n",
slowdown);
exit(1);
}
}