Ngxin project, which has a Windows version. to optimize performance, use timegettime (); to obtain the time.
As a result, the clock is unstable, and the clock does not run after a period of normal operation, or times out.
An error occurs when timegettime () is used to obtain the returned value. According to msdn, this function cannot be used directly for code operations.
Http://msdn.microsoft.com/en-us/library/ms713418.aspx
Timegettime
This can cause problems in code that directly uses the timegettime return value in computations, where the value is used to control code execution. You shoshould always use the difference between two timegettime return values
In computations.
Voidngx_gettimeofday (struct timeval * TP) {# ifdef ngx_win32 DWORD dt = timegettime (); // error code item TP-> TV _sec = (long) (Dt/1000 ); TP-> TV _usec = (long) (DT * 1000); # else ulonglong USEC; filetime ft; systemtime st; getsystemtime (& St); systemtimetofiletime (& St, & ft ); USEC = ft. dwhighdatetime; USEC <= 32; USEC | = ft. dwlowdatetime; USEC/= 10; USEC-= 11644473600000000ll; TP-> TV _sec = (long) (USEC/1000000); TP-> TV _usec = (long) (USEC % 1000000 ); # endif // ngx_win32}