dernier commit avant le Gers
This commit is contained in:
8
code/C/hacks.txt
Normal file
8
code/C/hacks.txt
Normal 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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user