You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 19:41:11 +00:00
Fix weekday calculation in get_datetime_from_unix_time for negative times
Fix calculation for negative times to ensure Sundays are wrapped around to '0'
instead of '7', making it consistent with the output for positive times.
(cherry picked from commit aae5f246ff)
This commit is contained in:
committed by
Rémi Verschelde
parent
5b7eb3fd3f
commit
cd3a3eb3eb
@@ -868,7 +868,7 @@ Dictionary _OS::get_datetime_from_unix_time(int64_t unix_time_val) const {
|
||||
} else {
|
||||
dayno = (unix_time_val - SECS_DAY + 1) / SECS_DAY;
|
||||
dayclock = unix_time_val - dayno * SECS_DAY;
|
||||
date.weekday = static_cast<OS::Weekday>((dayno - 3) % 7 + 7);
|
||||
date.weekday = static_cast<OS::Weekday>(((dayno % 7) + 11) % 7);
|
||||
do {
|
||||
year--;
|
||||
dayno += YEARSIZE(year);
|
||||
|
||||
Reference in New Issue
Block a user