-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
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
OS.get_time_from_unix_time(OS.get_unix_time()) returns wrong month at 0 o clock / sunday #4025
Comments
Yeah but this seems wrong. Check out this code:
Let me explain the meaning. Enums start at zero implicitly, unless you specify a number for any entry, then it increments by 1 contiguously. Anyhow, this means that MONTH_JANUARY == 0. This means MONTH_JANUARY != 1 in the code. That's not good IMO. Maybe I'll fix get_date? |
Check out this code. It's totally wrong:
It means it's essentially not march. This is broken everywhere actually. |
I guess the easiest thing is to change the enum to start at 1 (and I'll update the docs). Also hope there's nowhere else it's inconsistent. So far I see duplicate structures in:
|
LOL, I don't know what the convention is in Godot, but I am going to go with indexed at 1 since it is in all the get_date implementations and resolve the enums to follow this pattern. Looks like it was followed from Windows SYSTEMTIME structure: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx |
- Also updated the docs to reflect this. - Added some vim temp files to gitignore - Changed NaCL to be consistent with the other OS_Unix::get_date implementation (added 1 to month to map to 1-12) Ticket: godotengine#4025
@Razzlegames I thanked you on facebook for the help on this a while ago, but now I see that I have overlooked thanking you here personally as well for submitting a patch! Thank you 👍 Do you think we can close this issue now? |
Yes, this can be closed since it was fixed by #4027. |
No problem, Todor. I hope I can make some more when I get some free time :)
Happy Gamedev-ing all
…On Fri, Jun 16, 2017 at 6:28 PM, George Marques ***@***.***> wrote:
Closed #4025 <#4025>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4025 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AIWVf4JjPsVXVOTagsXecNBCR1cQXR0Nks5sEyvBgaJpZM4HvbcU>
.
|
Operating system or device:
Linux, github build from today
Issue description (what happened, and what was expected):
it is 0:45 - march 13, sunday, 2016
When I do: print (OS.get_time_from_unix_time(OS.get_unix_time()))
I get: (day:13), (hour:0), (minute:45), (month:2), (second:6), (weekday:0), (year:2016)
When I do: print (OS.get_date())
I get: (day:13), (dst:False), (month:3), (weekday:0), (year:2016)
When I print unix time a few minutes later, I get: 1457830499
Also is weekday 0 sunday? :)
The text was updated successfully, but these errors were encountered: