mktime64(9)
π« 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 convertdayβ the day you wanna converthourβ the hour you wanna convertminβ the minute you wanna convertsecβ 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/400terms, and add10. periodt. don't forget the10. π
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:
jiffies_to_msecs(9)jiffies_to_usecs(9)set_normalized_timespec64(9)ns_to_timespec64(9)__msecs_to_jiffies(9)__usecs_to_jiffies(9)timespec64_to_jiffies(9)jiffies_to_timespec64(9)jiffies_to_clock_t(9)clock_t_to_jiffies(9)jiffies_64_to_clock_t(9)nsec_to_clock_t(9)jiffies64_to_nsecs(9)jiffies64_to_msecs(9)nsecs_to_jiffies64(9)nsecs_to_jiffies(9)timespec64_add_safe(9)get_timespec64(9)put_timespec64(9)get_old_timespec32(9)put_old_timespec32(9)get_itimerspec64(9)put_itimerspec64(9)get_old_itimerspec32(9)put_old_itimerspec32(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms