mktime64(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« mktime64(9) πŸ’«

okay so bestie, this one lives in the Kernel API Manual and it's literally just "what if a date, but make it seconds" πŸŽ€


✨ NAME ✨

mktime64 β€” converts a date to seconds. that's it, that's the whole vibe.


🌸 SYNOPSIS 🌸

time64_t mktime64 (const unsigned int year0 , const unsigned int mon0 ,
const unsigned int day , const unsigned int hour , const unsigned int
min , const unsigned int sec );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • year0 β€” the year you wanna convert, queen πŸ‘‘
  • mon0 β€” the month you wanna convert
  • day β€” the day you wanna convert
  • hour β€” the hour you wanna convert
  • min β€” the minute you wanna convert
  • sec β€” the second you wanna convert

πŸ’… DESCRIPTION πŸ’…

So what it does is it converts a Gregorian date into seconds since 1970-01-01 00:00:00 ✨ the epoch, the moment it all began, main character energy fr fr.

It assumes your input is in normal date format, like:

1980-12-31 23:59:59 => year=1980, mon=12, day=31, hour=23, min=59, sec=59

see how that maps? iconic. no cap. 🫢

🌈 Julian calendar girlies, listen up: for the Julian calendar (which was used in Russia before 1917, Britain & colonies before 1752, anywhere else before 1582, and is still in use by some communities), you leave out the -year/100+year/400 terms, and add 10. periodt. don't forget the 10. πŸ’€

This algorithm was first published by Gauss (I think). and honestly? slay, Gauss. πŸ”₯

A leap second can be indicated by calling this function with sec as 60 β€” which is allowable under ISO 8601 😌 β€” and the leap second gets treated the same as the following second, since leap seconds literally don't exist in UNIX time. they just don't. they're not on the guest list. 🚫

An encoding of midnight at the end of the day as 24:00:00 β€” ie. midnight tomorrow ✨ β€” (also allowable under ISO 8601) is supported. so yes, 24:00:00 is valid here and it's giving "the day is over but also not". πŸ•›


πŸŽ€ RETURN πŸŽ€

seconds since the epoch time for the given input date πŸ’– that's the whole gift.


🌟 SEE ALSO 🌟

Kernel file ./kernel/time/time.c and literally the whole friend group:


and that's the whole page bestie!! πŸ’œ it's from ./kernel/time, dated October 2026, and it's filed under mktime64(9) β€” go convert some dates, ily, bye!! πŸ§šπŸ“

πŸ“¦ where this page comes from