[Original] time function implementation in WindowsCE

Source: Internet
Author: User
Tags filetime

When we create an application today,ProgramWe need to generate a random number and use time (0) to set the starting point of the random number. We found that wince has time. h: This header file, but it prompts that the time function is an unrecognizable symbol. Google, we found that there was no time function implementation in Lib, so...

Provides a time simulation function.CodeAs follows:

Time_t mytime (time_t * Intt)
{
Systemtime using imestruct;
Filetime ftime;
Ularge_integer int64time;
Time_t loctt
=   0 ;

If (intt = null)
intt
= & loctt;

Getsystemtime (&Systimestruct );

If (Systemtimetofiletime ( & Systimestruct, & Ftime ))
{
Memcpy (
& Int64time, & Ftime, Sizeof (Filetime ));
/* Subtract the value for (UTC) */
Int64time. quadpart -=   0x19db1ded53e8000 ;
/* Convert to seconds. */
Int64time. quadpart /=   10000000 ;
* Intt = Int64time. quadpart;
}
Return   * Intt;
}

 

 

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.