- wall = time(NULL) - start_time;
- if ((use_wall_clock ? wall : total.tv_sec) > timeout)
- die("Timeout exceeded (after exit).");
- fprintf(stderr, "OK (%d sec real, %d sec wall, %d syscalls)\n", (int) total.tv_sec, wall, syscall_count);
+ total_ms = total.tv_sec*1000 + total.tv_usec/1000;
+ gettimeofday(&now, NULL);
+ timersub(&now, &start_time, &wall);
+ wall_ms = wall.tv_sec*1000 + wall.tv_usec/1000;
+ if (timeout && total_ms > timeout)
+ die("Time limit exceeded");
+ if (wall_timeout && wall_ms > wall_timeout)
+ die("Time limit exceeded (wall clock)");
+ fprintf(stderr, "OK (%d.%03d sec real, %d.%03d sec wall, %d syscalls)\n",
+ (int) total.tv_sec, (int) total.tv_usec/1000,
+ (int) wall.tv_sec, (int) wall.tv_usec/1000,
+ syscall_count);