1difftime(3) Library Functions Manual difftime(3)
2
3
4
6 difftime - calculate time difference
7
9 Standard C library (libc, -lc)
10
12 #include <time.h>
13
14 double difftime(time_t time1, time_t time0);
15
17 The difftime() function returns the number of seconds elapsed between
18 time time1 and time time0, represented as a double. Each of the times
19 is specified in calendar time, which means its value is a measurement
20 (in seconds) relative to the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
21
23 For an explanation of the terms used in this section, see at‐
24 tributes(7).
25
26 ┌────────────────────────────────────────────┬───────────────┬─────────┐
27 │Interface │ Attribute │ Value │
28 ├────────────────────────────────────────────┼───────────────┼─────────┤
29 │difftime() │ Thread safety │ MT-Safe │
30 └────────────────────────────────────────────┴───────────────┴─────────┘
31
33 C11, POSIX.1-2008.
34
36 POSIX.1-2001, C89, SVr4, 4.3BSD.
37
39 On a POSIX system, time_t is an arithmetic type, and one could just
40 define
41
42 #define my_difftime(t1,t0) (double)(t1 - t0)
43
44 when the possible overflow in the subtraction is not a concern.
45
47 date(1), gettimeofday(2), time(2), ctime(3), gmtime(3), localtime(3)
48
49
50
51Linux man-pages 6.05 2023-07-20 difftime(3)