DC_DATETIME_LOCALTIME(3)

πŸ“¦ version 0.9.0, in nixos 26.05, nixpkgs unstable

✨ DC_DATETIME_LOCALTIME(3) ✨

okay so bestie, this one's from the Library Functions Manual (that's the manual name, cute right?) and it's literally gonna turn your timestamp into local time πŸ’…


🌸 NAME 🌸

dc_datetime_localtime β€” convert an timestamp to local date and time

(yes, "an timestamp", the original said it like that, we're keeping it, it's iconic 😭)


πŸŽ€ LIBRARY πŸŽ€

library β€œlibdivecomputer” 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libdivecomputer/datetime.h>

dc_datetime_t *
dc_datetime_localtime(dc_datetime_t *result, dc_ticks_t ticks);

πŸ’– DESCRIPTION πŸ’–

So what this does is, it takes an integral timestamp ticks β€” one of those you made with dc_datetime_now(3) or dc_datetime_mktime(3) β€” and converts it into a broken-down local-time representation, and drops it right into result. slay. ✨

The filled-in value consists of the year, month, day, hour, minute, and second fields. that's the whole glow-up, no cap.

⚠️ Note, bestie, this is important: unlike in struct tm, the value for year is normalised, not less 1900. and moreover, the value for month is from one, not zero. so like, don't come at it with your struct tm assumptions, it's built different πŸ’€

Also, lowkey, the dc_datetime_localtime function may internally invoke libc's localtime(3), or if available, localtime_r(3). iykyk 🧚


πŸ”₯ RETURN VALUES πŸ”₯

This returns the result pointer on success β€” main character behavior πŸ‘‘.

It returns NULL if ticks cannot be sanely converted, or if result is NULL. so like, vibe check your arguments, fr fr πŸ™ˆ


🌈 SEE ALSO 🌈

the whole squad, go read 'em πŸ’œ


πŸ’… AUTHORS πŸ’…

The library β€œlibdivecomputer” library was written by Jef Driesen, jef@libdivecomputer.org. and the manpages were written by Kristaps Dzonsons, kristaps@bsd.lv. absolute icons, both of them πŸŽ€β­


πŸ’« and that's the tea, bestie! this page came to you via Debian, dated January 11, 2017, and it's filed under DC_DATETIME_LOCALTIME(3) β€” go forth and convert those timestamps πŸ’«

πŸ“¦ where this page comes from