mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +00:00
LibC: Make tzset() set tzname to { "UTC", "UTC" }
Since tzset() itself pretends to succeed (it just sets timezone = 0 for now), it seems unwise to leave tzname uninitialized. Since Serenity already assumes UTC pretty much everywhere time is used, let's continue that trend here. Quoting POSIX: https://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html The tzset() function shall use the value of the environment variable TZ to set time conversion information used by ctime(), localtime(), mktime(), and strftime(). If TZ is absent from the environment, implementation-defined default timezone information shall be used. So we still don't care about TZ at all, but the program doesn't need to know! :^) This matches what musl libc ("UTC") and glibc ("GMT") do, see: - https://sourceware.org/git/?p=glibc.git;a=blob;f=time/tzset.c - https://git.musl-libc.org/cgit/musl/tree/src/time/__tz.c
This commit is contained in:
parent
3c68f557a9
commit
0d58e75910
1 changed files with 6 additions and 2 deletions
|
@ -322,15 +322,19 @@ size_t strftime(char* destination, size_t max_size, const char* format, const st
|
|||
return fits ? str.length() : 0;
|
||||
}
|
||||
|
||||
long timezone = 0;
|
||||
long timezone;
|
||||
long altzone;
|
||||
char* tzname[2];
|
||||
int daylight;
|
||||
|
||||
constexpr const char* __utc = "UTC";
|
||||
|
||||
void tzset()
|
||||
{
|
||||
//FIXME: Here we prepend we are in UTC+0.
|
||||
// FIXME: Here we pretend we are in UTC+0.
|
||||
timezone = 0;
|
||||
tzname[0] = const_cast<char*>(__utc);
|
||||
tzname[1] = const_cast<char*>(__utc);
|
||||
}
|
||||
|
||||
clock_t clock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue