Ticket #17863: timetest.c

File timetest.c, 416 bytes (added by thebuck, 20 months ago)

Got nothing unusual when testing on hrev56334 and hrev56475.

Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <unistd.h>
4#include <OS.h>
5
6int main(int argc, char* argv[]) {
7 int wait = 0;
8 if(argc>1) wait = atol(argv[1]);
9 bigtime_t t_old = 0;
10 while(1) {
11 bigtime_t t_new = system_time();
12 if(t_new < t_old) {
13 printf("PANIC: time goes backwards %d<%d\n", t_new, t_old);
14 return -1;
15 }
16 t_old = t_new;
17 if(wait) {
18 printf("t=%d\n", t_new);
19 usleep(wait);
20 }
21 }
22}