Incorrect time year of the WinCE System (record)

Source: Internet
Author: User

A strange problem has been found recently. The system time Year of Our WinCE device is incorrect. The specific situation is: after 2010, when the system time reaches the entire point, the Year will jump to 2016, and then immediately jump back to 2010. Furthermore, double-click the time icon in the lower-right corner to open the "date/time attribute" dialog box. For this reason, I wrote a small piece of code to get the system time in the code, and then display the time on a Static control. In this way, we can easily find this phenomenon. If we manually Change the system time from 2010 to 2011, the phenomenon will change to 2011, jump to 2017, and then jump back to 2011. This small hop will cause many application errors.

Then open the timer. c file under/KERNEL/HAL/ARM. The code segment that encountered the above problem has been found:

Lpst-> wSecond = FROM_BCD (s2440RTC-> rBCDSEC & 0x7f); </p> <p> lpst-> wMinute = FROM_BCD (s2440RTC-> rBCDMIN & 0x7f ); </p> <p> lpst-> wHour = FROM_BCD (s2440RTC-> rBCDHOUR & 0x3f ); </p> <p> lpst-> wDayOfWeek = (s2440RTC-> rBCDDATE-1 ); </p> <p> lpst-> wDay = FROM_BCD (s2440RTC-> rBCDDAY & 0x3f ); </p> <p> lpst-> wMonth = FROM_BCD (s2440RTC-> rBCDMON & 0x1f ); </p> <p> // lpst-> wYear = (2000 + s2440RTC-> rBCDYEAR ); </p> <p> lpst-> wYear = FROM_BCD (s2440RTC-> rBCDYEAR) + 2000; </p> <p> if (lpst-> wSecond = 0) </p> <p >{</p> <p> lpst-> wSecond = FROM_BCD (s2440RTC-> rBCDSEC & 0x7f ); </p> <p> lpst-> wMinute = FROM_BCD (s2440RTC-> rBCDMIN & 0x7f ); </p> <p> lpst-> wHour = FROM_BCD (s2440RTC-> rBCDHOUR & 0x3f ); </p> <p> lpst-> wDayOfWeek = (s2440RTC-> rBCDDATE-1 ); </p> <p> lpst-> wDay = FROM_BCD (s2440RTC-> rBCDDAY & 0x3f ); </p> <p> lpst-> wMonth = FROM_BCD (s2440RTC-> rBCDMON & 0x1f ); </p> <p> lpst-> wYear = (2000 + s2440RTC-> rBCDYEAR); </p> <p >}< br/>

It can be seen that this strange phenomenon occurs only when the entire score is reached? This is because it is determined by the if (lpst-> wSecond = 0) condition. It seems that the Code executed in this if statement may be faulty. Here, the year code is: lpst-> wYear = (2000 + s2440RTC-> rBCDYEAR); changed:

Lpst-> wYear = 2000 + FROM_BCD (s2440RTC-> rBCDYEAR); the problem is all right.

The problem was solved according to the instructions of others. This BSP package was modified by another departing employee based on other BSP packages. Another problem is that SetTimer is incorrect. You cannot solve the problem by yourself. Record it first.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.