Add Core::TimeZone as the single entry point for changing the current time zone. This updates both ICU and the process TZ/tzset state so libc-backed helpers such as AK::UnixDateTime::to_string() agree with JS/ICU time zone state. Previously only the ICU timezone would be updated, which could result in inconsistent results being returned.
20 lines
356 B
C++
20 lines
356 B
C++
/*
|
|
* Copyright (c) 2026, Shannon Booth <shannon@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Error.h>
|
|
#include <AK/String.h>
|
|
#include <AK/StringView.h>
|
|
#include <LibCore/Export.h>
|
|
|
|
namespace Core::TimeZone {
|
|
|
|
CORE_API ErrorOr<void> set_current_time_zone(StringView);
|
|
|
|
CORE_API String current_time_zone();
|
|
|
|
}
|