mirror of
https://gitlab.com/80486DX2-66/gists
synced 2024-11-12 22:45:54 +05:30
clock-malfunction-imitation.c: improve the style of macros
This commit is contained in:
parent
4f37c8a9fe
commit
6649720fcd
@ -23,13 +23,13 @@
|
||||
|
||||
#define CLOCK_FUN_BEGIN \
|
||||
static unsigned ticks_before_accident = TIME_BEFORE_ACCIDENT; \
|
||||
time_t y;
|
||||
time_t y
|
||||
|
||||
#define CLOCK_FUN_END \
|
||||
if (x != NULL) \
|
||||
*x = y; \
|
||||
\
|
||||
return y;
|
||||
return y
|
||||
|
||||
time_t clock_change_time(time_t* x);
|
||||
time_t clock_exponential_growth(time_t* x);
|
||||
@ -39,7 +39,7 @@ time_t clock_reverse(time_t* x);
|
||||
void time_flow_test(time_t (*time_function)(time_t*));
|
||||
|
||||
time_t clock_change_time(time_t* x) {
|
||||
CLOCK_FUN_BEGIN
|
||||
CLOCK_FUN_BEGIN;
|
||||
|
||||
time(&y);
|
||||
|
||||
@ -54,11 +54,11 @@ time_t clock_change_time(time_t* x) {
|
||||
} else
|
||||
ticks_before_accident--;
|
||||
|
||||
CLOCK_FUN_END
|
||||
CLOCK_FUN_END;
|
||||
}
|
||||
|
||||
time_t clock_exponential_growth(time_t* x) {
|
||||
CLOCK_FUN_BEGIN
|
||||
CLOCK_FUN_BEGIN;
|
||||
|
||||
static time_t counter = 1;
|
||||
|
||||
@ -70,11 +70,11 @@ time_t clock_exponential_growth(time_t* x) {
|
||||
} else
|
||||
ticks_before_accident--;
|
||||
|
||||
CLOCK_FUN_END
|
||||
CLOCK_FUN_END;
|
||||
}
|
||||
|
||||
time_t clock_hang(time_t* x) {
|
||||
CLOCK_FUN_BEGIN
|
||||
CLOCK_FUN_BEGIN;
|
||||
|
||||
static time_t last_time;
|
||||
|
||||
@ -86,11 +86,11 @@ time_t clock_hang(time_t* x) {
|
||||
ticks_before_accident--;
|
||||
}
|
||||
|
||||
CLOCK_FUN_END
|
||||
CLOCK_FUN_END;
|
||||
}
|
||||
|
||||
time_t clock_overflow(time_t* x) {
|
||||
CLOCK_FUN_BEGIN
|
||||
CLOCK_FUN_BEGIN;
|
||||
|
||||
time(&y);
|
||||
|
||||
@ -99,11 +99,11 @@ time_t clock_overflow(time_t* x) {
|
||||
else
|
||||
ticks_before_accident--;
|
||||
|
||||
CLOCK_FUN_END
|
||||
CLOCK_FUN_END;
|
||||
}
|
||||
|
||||
time_t clock_reverse(time_t* x) {
|
||||
CLOCK_FUN_BEGIN
|
||||
CLOCK_FUN_BEGIN;
|
||||
|
||||
static time_t counter = 1, old_time;
|
||||
|
||||
@ -115,7 +115,7 @@ time_t clock_reverse(time_t* x) {
|
||||
ticks_before_accident--;
|
||||
}
|
||||
|
||||
CLOCK_FUN_END
|
||||
CLOCK_FUN_END;
|
||||
}
|
||||
|
||||
void time_flow_test(time_t (*time_function)(time_t*)) {
|
||||
|
Loading…
Reference in New Issue
Block a user