fmt_iso8601(3)

fmt_iso8601(3) πŸ’–

okay bestie, welcome to the fmt_iso8601 page from the Library Functions Manual β€” this one's a lil baby, it's literally just "turn a timestamp into a cute string" and honestly? iconic for it. no cap. πŸŽ€


✨ NAME ✨

fmt_iso8601 β€” write a date in ASCII conforming to ISO-8601 πŸ¦‹


🌸 SYNTAX 🌸

#include <libowfat/fmt.h>

size_t fmt_iso8601(char *dest,time_t source);

like, that's the whole vibe. two args, one dream. πŸ’…


πŸ’– DESCRIPTION πŸ’–

so fmt_iso8601 writes a date in ASCII, exactly the way ISO-8601 defines it, and it looks like this:

"2014-05-27T19:22:16Z"

that's it, that's the format. πŸ“…βœ¨

ngl, ISO-8601 also allows you to store a sub-second part and a time zone, but fmt_iso8601 does not support that. it's giving minimalist. it's giving "we don't do that here". πŸ™ˆ

also, real talk: fmt_iso8601 does not append \0. so don't come for it expecting a null terminator, bestie, it's not gonna happen. πŸ’€

here's the lil party trick though β€” if dest equals FMT_LEN (i.e. is zero), then fmt_iso8601 returns the number of bytes it would have written. so you can ask it "how much room do i need?" and it just tells you, no drama. πŸ‘‘

and the return value of fmt_iso8601 is 20 until Jan 1st 10000. yes, twenty. until the year ten thousand. she's consistent. she's committed. periodt. ⭐


that's genuinely the whole page, bestie β€” short, sweet, and exactly 20 bytes of timestamp energy. go forth and format. 🫢


mwah πŸ’‹ this has been fmt_iso8601(3) straight outta the Library Functions Manual β€” thanks for scrolling with me, ily, drink water, and remember: no null terminator, no problem. πŸ§šπŸ’œ

πŸ“¦ where this page comes from