-
Notifications
You must be signed in to change notification settings - Fork 112
[k2] add Date/Time classes to light runtime #1481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
102 commits
Select commit
Hold shift + click to select a range
1ea6881
stash
Shamzik de28cdc
stash
Shamzik cf33fba
stash
Shamzik bb4c735
stash
Shamzik d9fb062
fixes
Shamzik 0c3dd19
datetime methods
Shamzik fa32f61
kphp::memory::libc_alloc_guard
Shamzik a6960b9
some tests
Shamzik bdecead
fixes
Shamzik f7ed08c
format
Shamzik 4619bdc
get_last_errors
Shamzik b7f9d61
error messages
Shamzik 28f92b2
test 12_create_interval.php
Shamzik 1f4aaf2
remove extra ';'
Shamzik 7cf3dc6
auto -> int32_t
Shamzik 4bf55ff
fixes
Shamzik b50703e
implement setISODate method
Shamzik b60ffe9
implement sub methods
Shamzik 22b8dd8
implement getOffset methods
Shamzik dc5c81e
construct -> parse
Shamzik f4c71eb
use destructor{}
Shamzik f4f6d29
move NOW_STR into time state
Shamzik d5cba95
remove include
Shamzik f69ff84
use type wrappers
Shamzik a4fdf9c
fix parse_interval
Shamzik 903bcb7
refactoring
Shamzik bca5cc6
destructors
Shamzik 722803d
revert string_decl
Shamzik 1ae6379
move string_back_insert_iterator into separated header
Shamzik b72569d
fixes
Shamzik 063c78d
move NOW_ into TimeImageState
Shamzik 5ce4529
move destructors into details namespace
Shamzik 01ec2fc
remove `_t` suffix
Shamzik 16f47e5
fix
Shamzik bcab4b3
rename
Shamzik 4c0d07d
fixes
Shamzik 5ab3b67
std::string_view
Shamzik 3e21836
make tzinfo wrapper
Shamzik 3b4ad77
lambdas & includes
Shamzik 40671af
remove const
Shamzik 69bf18e
fix fill_holes_with_now_info
Shamzik b96d7f2
std::size_t -> size_t
Shamzik 42e7b8c
optimize libc_alloc_guard
Shamzik ef144b3
fix weekYearSet
Shamzik e7772b4
swap -> move
Shamzik 58ea8ed
Copyright (c) 2026 LLC «V Kontakte»
Shamzik d99e4cb
rename files
Shamzik bdaa10f
move some functions into headers
Shamzik b5467df
get_timezone_info
Shamzik 4f63cce
remove _sv suffixes
Shamzik f0efc5e
std::output_iterator<const char&>
Shamzik 90cdede
revert put method
Shamzik 80aae55
remove make method
Shamzik 6420426
fixes
Shamzik 79cb5b7
fixed formatted_* args
Shamzik 081eb61
fixes
Shamzik 097ea30
fix split commens
Shamzik 42f2ef1
fix parse_interval
Shamzik bfbf8f9
move some timelib functions to header
Shamzik 8c64b6b
full qualified names
Shamzik bc2e1e5
move chrono up
Shamzik a20610a
fix timelib_parse_tzfile usage
Shamzik e496a39
refactor timezone_cache initialization
Shamzik ca808f6
move TimeInstanceState::get() to local var
Shamzik 64568d3
move small date-time functions into headers
Shamzik e9c7f6e
includes
Shamzik 840d90d
move common timelib functions into runtime-common
Shamzik 29c2fd6
format
Shamzik 7303222
remove iterator.h
Shamzik 7e49066
fixes
Shamzik 2b89c3b
fix timelib.cmake
Shamzik 26deb64
fixes
Shamzik 8d7ef0f
common define for runtimes
Shamzik 4a4317b
2026
Shamzik e37820f
fix gen_error_msg
Shamzik 2bec904
undo template files
Shamzik c4929b0
remove type aliases
Shamzik 958bc6e
move `sign` functions up
Shamzik cd17d65
improve string::append
Shamzik 1bf3373
cc
Shamzik b472cdb
fix checkdate
Shamzik d370b56
fix includes
Shamzik c658646
link runtime-light to timelib
Shamzik 92b7f45
write diff as bytes
Shamzik 7147fd8
revert compiler-settings.cpp format
Shamzik 63b990e
remove static_buf alias
Shamzik 47fcb5d
use holders as possible
Shamzik 22fcc11
make default methods of timezone_cache
Shamzik 6f896f4
move string constants of get_last_errors into image state
Shamzik 867cdd6
#include <cstring>
Shamzik 1d2db98
move get_time_interval to header
Shamzik fa2c595
parse_time -> kphp::timelib::parse_time
Shamzik 62ecfa8
add warning in timezone_cache init
Shamzik b719fd4
fix ExtraRefCnt::for_global_const
Shamzik 183e0ec
auto -> const auto*
Shamzik 7b42135
uppercase static constexpr
Shamzik 3555039
add timezone to DateTimeZone
Shamzik 0e0d278
use std::strlen
Shamzik 08eff85
move f$DateInterval$$__construct to cpp file
Shamzik f0203a4
use std::optional for get_last_errors
Shamzik 7d643f5
string optimizations
Shamzik d6ece61
fix appending char
Shamzik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // Compiler for PHP (aka KPHP) | ||
| // Copyright (c) 2026 LLC «V Kontakte» | ||
| // Distributed under the GPL v3 License, see LICENSE.notice.txt | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <array> | ||
|
|
||
| namespace kphp::timelib { | ||
|
|
||
| namespace timezones { | ||
|
|
||
| inline constexpr const char* MOSCOW = "Europe/Moscow"; | ||
| inline constexpr const char* GMT3 = "Etc/GMT-3"; | ||
| inline constexpr const char* GMT4 = "Etc/GMT-4"; | ||
|
|
||
| } // namespace timezones | ||
|
|
||
| namespace months { | ||
|
|
||
| constexpr inline std::array<const char*, 12> FULL_NAMES = {"January", "February", "March", "April", "May", "June", | ||
| "July", "August", "September", "October", "November", "December"}; | ||
| constexpr inline std::array<const char*, 12> SHORT_NAMES = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; | ||
|
|
||
| } // namespace months | ||
|
|
||
| namespace days { | ||
|
|
||
| constexpr inline std::array<const char*, 7> FULL_NAMES = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; | ||
| constexpr inline std::array<const char*, 7> SHORT_NAMES = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; | ||
|
|
||
| } // namespace days | ||
|
|
||
| } // namespace kphp::timelib | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.