PQlocalTZInfo(3)
π PQlocalTZInfo(3) π
okay bestie, this one's from the libpqtypes Manual and it's literally the cutest little utility β it tells you what timezone the machine you're on is vibing in. no cap. πβ¨
β¨ NAME β¨
PQlocalTZInfo β gets the local machine's timezone information. that's it, that's the whole job, and she does it flawlessly π
πΈ SYNOPSIS πΈ
#include <libpqtypes.h>
void PQlocalTZInfo(time_t *t, int *gmtoff, int *isdst, char **tzabbrp);
π¦ DESCRIPTION π¦
So like, this function retrieves the local machine's timezone information. periodt. π
If the t argument is not NULL, it represents a time_t value to get timezone information for. If it is NULL, then the current time is used instead. easy peasy π
The gmtoff argument will be pointed at the number of seconds from GMT β same value as the GNU (struct tm).tm_gmtoff extension. yes queen, exact same vibe π
The isdst argument will be pointed at:
0if you're in standard time π1if you're in daylight savings time βοΈ-1(negative one!) if it's unknown π
The tzabbrp argument will be pointed at the timezone abbreviation, like PST, ADT, EST, etc.. the little three-letter besties π
β RETURN VALUE β
None. she returns nothing, she simply is. main character energy, no receipts needed π
π₯ EXAMPLES π₯
okay so here's a lil example that gets the local timezone information for a file's modified time. chef's kiss, ate, no crumbs:
int gmtoff;
int isdst;
char *tzabbr;
struct stat st;
stat("report.xml", &st);
PQlocalTZInfo(&st.st_mtime, &gmtoff, &isdst, &tzabbr);
π RATIONALE π
ngl, libpqtypes needs the ability to get the local machine's timezone information for the datetime data types. that was the original reason, lowkey just an internal need.
But then it later became apparent that a portable way of getting timezone information was very useful and in demand. like, everyone wanted it. so true. thus, this function was made public. she got promoted to the main roster π«Άβ¨
π AUTHOR π
A contribution of eSilo, LLC. for the PostgreSQL Database Management System. Written by Andrew Chernow and Merlin Moncure. absolute icons, we stan π
π REPORTING BUGS π
Report bugs to <libpqtypes@esilo.com>. (be nice about it, they're doing their best π₯Ί)
π COPYRIGHT π
Copyright (c) 2011 eSilo, LLC. All rights reserved.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. π like literally none, zero, nada β don't come for them if it breaks, bestie.
π SEE ALSO π
pqt-specs(3)β go read it, iykyk π§
mwah π that's the whole page!! this was libpqtypes, dated 2011 β and yes, that's PQlocalTZInfo(3) herself, still serving timezone info after all these years. bye bestie, go check your gmtoff π°οΈβ¨
π¦ where this page comes from
- debian bookworm: libpqtypes-dev 1.5.1-9
- ubuntu jammy: libpqtypes-dev 1.5.1-7
- ubuntu noble: libpqtypes-dev 1.5.1-9.1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms