diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-06-29 09:19:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-29 09:19:01 +0200 |
commit | 9f9fa07f07715c9e4097cd30cf7f8a1630ca118c (patch) | |
tree | ea797c420401da5468326e0146274ef8945bfb80 | |
parent | 481151be09108a30002ae0a9df118eeddd3987be (diff) | |
parent | aae5f246ff3b29a6a60d438d71523c8cc139be1b (diff) |
Merge pull request #39935 from mrushyendra/datetime_negative
Fix weekday calculation in get_datetime_from_unix_time for negative times
-rw-r--r-- | core/bind/core_bind.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 267391c4d6..cb82dc7f8f 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -454,7 +454,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); |