| 1 |
'\" t |
| 2 |
.\" Copyright 1993, David Metcalfe <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH difftime 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
difftime \- calculate time difference |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <time.h> |
| 16 |
.P |
| 17 |
.BI "double difftime(time_t " time1 ", time_t " time0 ); |
| 18 |
.fi |
| 19 |
.SH DESCRIPTION |
| 20 |
The |
| 21 |
.BR difftime () |
| 22 |
function returns the number of seconds elapsed |
| 23 |
between time |
| 24 |
.I time1 |
| 25 |
and time |
| 26 |
.IR time0 , |
| 27 |
represented as a |
| 28 |
.IR double . |
| 29 |
Each time is a count of seconds. |
| 30 |
.P |
| 31 |
.I difftime(b,\~a) |
| 32 |
acts like |
| 33 |
.I (b\-a) |
| 34 |
except that the result does not overflow and is rounded to |
| 35 |
.IR double . |
| 36 |
.SH ATTRIBUTES |
| 37 |
For an explanation of the terms used in this section, see |
| 38 |
.BR attributes (7). |
| 39 |
.TS |
| 40 |
allbox; |
| 41 |
lbx lb lb |
| 42 |
l l l. |
| 43 |
Interface Attribute Value |
| 44 |
T{ |
| 45 |
.na |
| 46 |
.nh |
| 47 |
.BR difftime () |
| 48 |
T} Thread safety MT-Safe |
| 49 |
.TE |
| 50 |
.SH STANDARDS |
| 51 |
C11, POSIX.1-2008. |
| 52 |
.SH HISTORY |
| 53 |
POSIX.1-2001, C89, SVr4, 4.3BSD. |
| 54 |
.SH SEE ALSO |
| 55 |
.BR date (1), |
| 56 |
.BR gettimeofday (2), |
| 57 |
.BR time (2), |
| 58 |
.BR ctime (3), |
| 59 |
.BR gmtime (3), |
| 60 |
.BR localtime (3) |