times(2) System Calls Manual times(2) times - LIBRARY Standard C library (libc, -lc) #include clock_t times(struct tms *buf); times() struct tms, buf. struct tms : struct tms { clock_t tms_utime; /* */ clock_t tms_stime; /* */ clock_t tms_cutime; /* */ clock_t tms_cstime; /* */ }; tms_utime , . tms_stime , . tms_cutime tms_utime tms_cutime . tms_cstime tms_stime tms_cstime . ( ) wait(2) waitpid(2) ID . , , , . . times() returns the number of clock ticks that have elapsed since an arbitrary point in the past. The return value may overflow the possible range of type clock_t. On error, (clock_t) -1 is returned, and errno is set to indicate the error. EFAULT tms . Linux buf NULL. times() . POSIX , UNIX NULL buf. POSIX.1-2008. POSIX.1-2001, SVr4, 4.3BSD. POSIX.1-1996 CLK_TCK ( ) . . Before Linux 2.6.9, if the disposition of SIGCHLD is set to SIG_IGN, then the times of terminated children are automatically included in the tms_cstime and tms_cutime fields, although POSIX.1-2001 says that this should happen only if the calling process wait(2)s on its children. This nonconformance is rectified in Linux 2.6.9 and later. On Linux, the "arbitrary point in the past" from which the return value of times() is measured has varied across kernel versions. On Linux 2.4 and earlier, this point is the moment the system was booted. Since Linux 2.6, this point is (2^32/HZ) - 300 seconds before system boot time. This variability across kernel versions (and across UNIX implementations), combined with the fact that the returned value may overflow the range of clock_t, means that a portable application would be wise to avoid using this value. To measure changes in elapsed time, use clock_gettime(2) instead. SVr1-3 long time_t, , . V7 long , time_t . : sysconf(_SC_CLK_TCK); , clock(3) clock_t, CLOCKS_PER_SEC, times(). Linux ( i386) , Linux 2.6 (41 ), times() -1, . , clock_t. . time(1), getrusage(2), wait(2), clock(3), sysconf(3), time(7) Azamat Hackimov , Dmitry Bolkhovskikh , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . times(2)