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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions targets/CMSIS-OS/ChibiOS/nanoCLR/targetHAL_Time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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!! 👏

st.wDayOfWeek = (unsigned short) _dateTime.dayofweek;

// zero 'time' fields if date part only is required
Expand All @@ -45,7 +45,7 @@ signed __int64 HAL_Time_CurrentDateTime(bool datePartOnly)
st.wMilliseconds = 0;
st.wSecond = 0;
st.wMinute = 0;
st.wMinute = 0;
st.wHour = 0;
}
else
{
Expand All @@ -57,7 +57,7 @@ signed __int64 HAL_Time_CurrentDateTime(bool datePartOnly)
_dateTime.millisecond /= 60;
st.wMinute = (unsigned short) (_dateTime.millisecond % 60);
_dateTime.millisecond /= 60;
st.wMinute = (unsigned short) (_dateTime.millisecond % 24);
st.wHour = (unsigned short) (_dateTime.millisecond % 24);
}

return HAL_Time_ConvertFromSystemTime( &st );
Expand Down