/** * @file now.c * @brief Microseconds since the epoch, for the start-up benchmark. * * `bench/startup.sh` needs a wall clock finer than a second: one * `shell -c :` costs milliseconds, and /bin/date on z/OS has no * sub-second format. Only a difference of two readings is wanted, and * the arithmetic that takes it is 32-bit on z/OS sh, so the value is * reduced to a 1000-second window: enough for any one benchmark run, * and it fits in 2^31. */ #include #include int main(void) { struct timespec ts; if (clock_gettime(CLOCK_REALTIME, &ts) < 0) return 1; printf("%lld\n", (long long)(ts.tv_sec % 1000) * 1000000 + ts.tv_nsec / 1000); return 0; }