d1a424c002
This will allow us to redefine the exit function.
For example:
```
#define exit(code) { \
fprintf(stderr, "%s:%d: exit(%s) in function ‘%s’\n",
__FILE__, __LINE__, #code, __func__); \
_exit(code); \
}
```
26 lines
475 B
C
26 lines
475 B
C
#include <time.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
struct timespec tm = {0, 0};
|
|
|
|
int cgt = clock_gettime(CLOCK_REALTIME, &tm);
|
|
if (cgt == -1) {
|
|
perror("clock_gettime");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
time_t t = time(NULL);
|
|
if (t == (time_t)-1) {
|
|
perror("time");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
clock_t c = clock();
|
|
if (c == (clock_t)-1) {
|
|
perror("clock");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
}
|