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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms