inux下gettimeofday函数windows替换方法(详解)
程序员文章站
2023-11-03 14:29:34
实例如下:
#include
#ifdef win32
# include
#else...
实例如下:
#include <time.h> #ifdef win32 # include <windows.h> #else # include <sys/time.h> #endif #ifdef win32 int gettimeofday(struct timeval *tp, void *tzp) { time_t clock; struct tm tm; systemtime wtm; getlocaltime(&wtm); tm.tm_year = wtm.wyear - 1900; tm.tm_mon = wtm.wmonth - 1; tm.tm_mday = wtm.wday; tm.tm_hour = wtm.whour; tm.tm_min = wtm.wminute; tm.tm_sec = wtm.wsecond; tm. tm_isdst = -1; clock = mktime(&tm); tp->tv_sec = clock; tp->tv_usec = wtm.wmilliseconds * 1000; return (0); } #endif
以上就是小编为大家带来的inux下gettimeofday函数windows替换方法(详解)全部内容了,希望大家多多支持~
上一篇: 小米9移动4G+版降价:性价无敌
下一篇: div+css如何实现页脚的置底