+ int r;
+ if (cgt) return cgt(clk, ts);
+ r = __syscall(SYS_clock_gettime, clk, ts);
+ if (!r) return r;
+ if (r == -ENOSYS) {
+ cgt = 0;
+ if (clk == CLOCK_REALTIME) {
+ __syscall(SYS_gettimeofday, clk, ts, 0);
+ ts->tv_nsec = (int)ts->tv_nsec * 1000;
+ return 0;
+ }
+ r = -EINVAL;
+ }
+ errno = -r;
+ return -1;