Skip to content
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

DateTime support #17

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

DateTime support #17

wants to merge 6 commits into from

Conversation

JoshuaWierenga
Copy link
Owner

@JoshuaWierenga JoshuaWierenga commented Feb 10, 2021

As many public functions and properties as possible have been added with EFI_TIME forming the backend for DateTime.Now.

The lack of exception support leads to most of the constructors have slightly modified results to normal with invalid inputs being replaced with defaults rather than causing crashes.

I am currently considering if NotNullWhenAttribute, TypeCode, IConvertible and IFormatProvider are worth adding for the small number of functions they add or make identical to the dotnet version.

It is now possible to get the current date and time with unsafe code using the GetTime function.
Currently, the only constructor requires values for year, month, day, hour, minute and second and all 6 can be manually retrieved afterwards. Additionally Now is support which means there is now a way to get the time outside of unsafe code.
Added everything i could without adding other files that may have their own issues.
Updated DateTime constructors to somewhat deal with the lack of exception support. Results still vary from dotnet behaviour but it does work.
Added DateTime.DoubleDateToTicks and FromOADate, another place where the lack of exception supports means some weird changes had to be made.
It looks like as soon as exceptions are supported, this file could be replaced with the proper version.
Added platform specific version of DateTime to hold s_systemSupportsLeapSeconds.
@JoshuaWierenga JoshuaWierenga added the enhancement New feature or request label Feb 10, 2021
@JoshuaWierenga JoshuaWierenga marked this pull request as draft February 10, 2021 10:23
@JoshuaWierenga JoshuaWierenga mentioned this pull request Feb 10, 2021
12 tasks
This ideally means that DateTime shouldn't have to be looked at much after #17, the only major thing missing now is exception handling.
@JoshuaWierenga
Copy link
Owner Author

Before merging, every function needs to be at least somewhat tested, especially those that I had to modify to compile and run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant