difftime(3)
π NAME π
okay bestie, say hi to difftime β she calculates the time difference β¨
π LIBRARY π
Standard C library, aka libc, and you link her with -lc π
β¨ SYNOPSIS β¨
#include <time.h>
double difftime(time_t time1, time_t time0);
πΈ DESCRIPTION πΈ
so difftime() hands you back the number of seconds that elapsed between the time time1 and the time time0, and it gives it to you as a double π
each of those times is literally just a count of seconds, no cap.
and here's the iconic part: difftime(b, a) acts like (b-a), EXCEPT the result does not overflow and it's rounded to double. the way she protects you from overflow?? main character energy π
π¦ ATTRIBUTES π¦
for the whole explanation of the terms used down here, go peek at attributes(7) π«Ά
- Interface:
difftime() - Attribute: Thread safety
- Value:
MT-Safe
so yeah, she's thread safe, she can hang with everybody at once, no drama π
β STANDARDS β
C11, POSIX.1-2008 β¨
π HISTORY π
POSIX.1-2001, C89, SVr4, 4.3BSD β she's been around, she's vintage, she's an icon π
π SEE ALSO π
date(1), gettimeofday(2), time(2), ctime(3), gmtime(3), localtime(3)
okay that's the whole page, bestie π this one came from Linux man-pages 6.20, dated 2026-02-08, and yeah the page you're on is difftime(3) π¦ go time-diff something, ily, bye π
πΈ
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 1993, David Metcalfe <david@prism.demon.co.uk>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms