mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:37:34 +00:00
LibTimeZone: Parse ZONE entries from the TZDB and generate their names
This commit is contained in:
parent
41f4a5050c
commit
9253e695d1
5 changed files with 260 additions and 4 deletions
|
@ -6,3 +6,15 @@ if (DEFINED TIME_ZONE_DATA_SOURCES)
|
|||
target_compile_options(LibTimeZoneData PRIVATE -g0 -Os)
|
||||
target_link_libraries(LibTimeZoneData LibCore)
|
||||
endif()
|
||||
|
||||
set(SOURCES
|
||||
TimeZone.cpp
|
||||
)
|
||||
|
||||
serenity_lib(LibTimeZone timezone)
|
||||
target_link_libraries(LibTimeZone LibCore)
|
||||
target_compile_definitions(LibTimeZone PRIVATE ENABLE_TIME_ZONE_DATA=$<BOOL:${ENABLE_TIME_ZONE_DATABASE_DOWNLOAD}>)
|
||||
|
||||
if (DEFINED TIME_ZONE_DATA_SOURCES)
|
||||
target_link_libraries(LibTimeZone LibTimeZoneData)
|
||||
endif()
|
||||
|
|
15
Userland/Libraries/LibTimeZone/Forward.h
Normal file
15
Userland/Libraries/LibTimeZone/Forward.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Tim Flynn <trflynn89@pm.me>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
|
||||
namespace TimeZone {
|
||||
|
||||
enum class TimeZone : u16;
|
||||
|
||||
}
|
13
Userland/Libraries/LibTimeZone/TimeZone.cpp
Normal file
13
Userland/Libraries/LibTimeZone/TimeZone.cpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Tim Flynn <trflynn89@pm.me>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibTimeZone/TimeZone.h>
|
||||
|
||||
namespace TimeZone {
|
||||
|
||||
Optional<TimeZone> __attribute__((weak)) time_zone_from_string(StringView) { return {}; }
|
||||
|
||||
}
|
17
Userland/Libraries/LibTimeZone/TimeZone.h
Normal file
17
Userland/Libraries/LibTimeZone/TimeZone.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Tim Flynn <trflynn89@pm.me>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibTimeZone/Forward.h>
|
||||
|
||||
namespace TimeZone {
|
||||
|
||||
Optional<TimeZone> time_zone_from_string(StringView time_zone);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue