TZSET(3P)
π TZSET(3P) π
okay bestie, so this one is from the POSIX Programmer's Manual, and it's giving "the clock is a social construct but the timezone conversion info is very much real" β¨
πΈ PROLOG πΈ
so like, heads up: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (fr fr, go check the corresponding Linux manual page for the Linux tea), or the interface may not even be implemented on Linux at all. π
β¨ NAME β¨
daylight, timezone, tzname, tzset β set timezone conversion information π°οΈ
π SYNOPSIS π
#include <time.h>
extern int daylight;
extern long timezone;
extern char *tzname[2];
void tzset(void);
π DESCRIPTION π
The tzset() function shall use the value of the environment variable TZ to set time conversion information used by ctime(), localtime(), mktime(), and strftime(). And if TZ is absent from the environment? Then implementation-defined default timezone information shall be used. no cap.
The tzset() function shall set the external variable tzname as follows:
tzname[0] = "std";
tzname[1] = "dst";
where std and dst are as described in the Base Definitions volume of POSIX.1β2017, Chapter 8, Environment Variables. iykyk π¦
The tzset() function also shall set the external variable daylight to 0 if Daylight Savings Time conversions should never be applied for the timezone in use; otherwise, non-zero. And the external variable timezone shall be set to the difference, in seconds, between Coordinated Universal Time (UTC) and local standard time. literally the whole vibe. β
π¨ okay so this part is important: if a thread accessestzname,daylight, ortimezonedirectly while another thread is in a call totzset(), or to any function that is required or allowed to set timezone information as if by callingtzset(), the behavior is undefined. undefined bestie. that's the scary one. π
π RETURN VALUE π
The tzset() function shall not return a value. it simply does not do that. π
π ERRORS π
No errors are defined. iconic behavior honestly. π
The following sections are informative.
π₯ EXAMPLES π₯
Example TZ variables and their timezone differences are given below (the original had this in a table but we're doing a cute list instead π):
EST5EDTβtimezone=5*60*60GMT0βtimezone=0*60*60JST-9βtimezone=-9*60*60MET-1MESTβtimezone=-1*60*60MST7MDTβtimezone=7*60*60PST8PDTβtimezone=8*60*60
π§ APPLICATION USAGE π§
Since the ctime(), localtime(), mktime(), strftime(), and strftime_l() functions are required to set timezone information as if by calling tzset(), there is no need for an explicit tzset() call before using these functions. like they just handle it, bestie. π
BUT. However. π portable applications should call tzset() explicitly before using ctime_r() or localtime_r(), because setting timezone information is optional for those functions. so do it, okay? do it for me.
π RATIONALE π
None.
(yeah. nothing. empty. the void. π)
π¦ FUTURE DIRECTIONS π¦
None.
(also nothing. also the void. β¨)
β SEE ALSO β
ctime()localtime()mktime()strftime()
The Base Definitions volume of POSIX.1β2017, Chapter 8, Environment Variables, <time.h>
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page bestie π«Ά shoutout to IEEE/The Open Group, 2017, for bringing us TZSET(3P) β the timezone queen herself, slaying since forever. mwah. ππβ¨
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms