ngnix 时钟 ngx_gettimeofday 更新时间
来源:互联网 发布:大疆无人机 人工智能 编辑:程序博客网 时间:2024/04/28 10:40
ngxin 项目,有 windows 版本,之前为了优化性能,用 timeGetTime(); 获取时间。
这样导致了时钟不稳定,时钟正常跑一段时间后就不跑了,或者超时。
用 timeGetTime(); 获取返回的数值不定时出现问题。按 msdn 说,这个函数不能单独直接使用于代码运算。
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, particularly where the value is used to control code execution. You should always use the difference between two timeGetTime return values in computations.
voidngx_gettimeofday(struct timeval *tp){#ifdef NGX_WIN32 DWORD dt = timeGetTime(); // 错误代码项 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}
- ngnix 时钟 ngx_gettimeofday 更新时间
- Linux 内核时钟之进程时间更新
- linux更新系统时间&检测到系统时钟错误解决办法
- iOS 数字时钟(时间显示并持续更新)
- ngnix
- React 更新元素时钟
- 时间管理器,时钟
- 更新时间
- Linux中的时钟与时间
- Linux中的时钟与时间
- UCOS 时钟及时间管理
- DirectShow 04 - 时间和时钟
- 动态时钟的时间设置
- QT时间触发电子时钟
- 【ngnix】ngnix源代码分析
- 日历时间 时钟时间 用户CPU时间 系统CPU时间
- 用户CPU时间 系统CPU时间 时钟时间
- 时钟时间 用户cpu时间 系统cpu时间
- 在指定目录下创建文件夹
- 代码里添加systrace跟踪(三)
- 此生爱你无悔,爱走到了尽头,唯一只有放手
- Java和Jsp 中 request.getHeader() 详细说明
- 架构妄想:AJAX + REST
- ngnix 时钟 ngx_gettimeofday 更新时间
- 探讨笨蛋问题!!!
- sql server取当天8点到20点的数据
- 利用非递归方法实现二叉树的先序遍历
- 关于网络爬虫
- 公告:CSDN新版论坛即将正式上线,周末暂停服务
- 游戏服务器运维
- linux下scp命令(远程文件拷贝)详解
- 求水花仙数