DC_DATETIME_LOCALTIME(3)
β¨ 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 instruct tm, the value foryearis normalised, not less 1900. and moreover, the value formonthis from one, not zero. so like, don't come at it with yourstruct tmassumptions, 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
- nixos 26.05: libdivecomputer 0.9.0
- nixpkgs unstable: libdivecomputer 0.9.0
- Copyright (C) 2017 Kristaps Dzonsons <kristaps@bsd.lv>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms