mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-01 22:29:13 +00:00
LibUnicode: Cache the system time zone
It's expensive to determine the system time zone from disk each time it is requested. This makes LibUnicode cache the result, and provides an API to clear that cache. This will let us set up a monitor to watch for system time zone changes in platform-dependent ways.
This commit is contained in:
committed by
Andreas Kling
parent
e25681203e
commit
b31c11bca5
@@ -8,6 +8,7 @@
|
||||
#include <LibCore/Environment.h>
|
||||
#include <LibJS/Runtime/ArrayBuffer.h>
|
||||
#include <LibTest/JavaScriptTestRunner.h>
|
||||
#include <LibUnicode/TimeZone.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -106,6 +107,7 @@ TESTJS_GLOBAL_FUNCTION(set_time_zone, setTimeZone)
|
||||
return vm.throw_completion<JS::InternalError>(MUST(String::formatted("Could not set time zone: {}", result.error())));
|
||||
}
|
||||
|
||||
Unicode::clear_system_time_zone_cache();
|
||||
tzset();
|
||||
|
||||
return current_time_zone;
|
||||
|
||||
Reference in New Issue
Block a user