Call time () under WinCE

Source: Internet
Author: User
Tags filetime
  1. Time_t time (time_t * intt ){
  2. Systemtime using imestruct;
  3. Filetime ftime;
  4. Ularge_integer int64time;
  5. Time_t loctt = 0;
  6.  
  7. If (intt = NULL ){
  8. Intt = & loctt;
  9. }
  10.  
  11. Getsystemtime (& policimestruct );
  12. If (systemtimetofiletime (& policimestruct, & ftime )){
  13. Memcpy (& int64time, & ftime, sizeof (filetime ));
  14. /* Subtract the value for 1970-01-01 00:00 (UTC )*/
  15. Int64time. quadpart-= 0 × 19db1ded53e8000;
  16. /* Convert to seconds .*/
  17. Int64 time. quadpart/= 10000000;
  18. * Intt = int64time. quadpart;
  19. }
  20.  
  21. Return * intt;
  22. }



    The local time zone uses the getlocaltime function.

    What we get is Beijing time and there is no need to change it.

    Actually, Windows does not support time () calls. Lib is not implemented,
    It took three hours to find out today, a waste of time.

    The current method is to call ctime: getcurrenttime () or Windows API getsystemtime ()

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.