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

Update targetHAL_Time.cpp #548

Merged
merged 1 commit into from
Dec 17, 2017
Merged

Update targetHAL_Time.cpp #548

merged 1 commit into from
Dec 17, 2017

Conversation

ghost
Copy link

@ghost ghost commented Dec 17, 2017

Description

Fixes incorrect handling of internal system time.

Motivation and Context

How Has This Been Tested?

With a time set internally to 12/17/2017 08:00:00,
Console.WriteLine("utcNow : " + DateTime.UtcNow.ToString());
is returning
utcNow : 12/17/2017 08:00:39
The 39 seconds are due to the manual startup time of the debug session after the board's reset.

Fixes nanoframework/Home#257.

Now, with a time set internally to 12/17/2017 08:00:00, 
`Console.WriteLine("utcNow : " + DateTime.UtcNow.ToString());`
is returning 
`utcNow : 12/17/2017 08:00:39`  (The 39 seconds are due to the manual startup time of the debug session after the board's reset)
@nfbot
Copy link
Member

nfbot commented Dec 17, 2017

Hi @MikroBusNet,

I'm nanoFramework bot.
Thank you for your contribution!

A human will be reviewing it shortly. 😉

Copy link
Member

@piwi1263 piwi1263 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem replicated, solution tested and no issues found.

@piwi1263 piwi1263 merged commit dac83e0 into develop Dec 17, 2017
@josesimoes josesimoes deleted the MBN-DateTime branch December 20, 2017 11:04
@@ -36,7 +36,7 @@ signed __int64 HAL_Time_CurrentDateTime(bool datePartOnly)

st.wDay = (unsigned short) _dateTime.day;
st.wMonth = (unsigned short) _dateTime.month;
st.wYear = (unsigned short) _dateTime.year;
st.wYear = (unsigned short) (_dateTime.year + 1980); // ChibiOS is counting years since 1980
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MikroBusNet nice catch!! 👏

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

Successfully merging this pull request may close these issues.

3 participants