Merge pull request #39935 from mrushyendra/datetime_negative
Fix weekday calculation in get_datetime_from_unix_time for negative times
This commit is contained in:
commit
9f9fa07f07
1 changed files with 1 additions and 1 deletions
|
@ -454,7 +454,7 @@ Dictionary _OS::get_datetime_from_unix_time(int64_t unix_time_val) const {
|
||||||
} else {
|
} else {
|
||||||
dayno = (unix_time_val - SECS_DAY + 1) / SECS_DAY;
|
dayno = (unix_time_val - SECS_DAY + 1) / SECS_DAY;
|
||||||
dayclock = unix_time_val - dayno * 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 {
|
do {
|
||||||
year--;
|
year--;
|
||||||
dayno += YEARSIZE(year);
|
dayno += YEARSIZE(year);
|
||||||
|
|
Loading…
Reference in a new issue