timeval结构不正确? [英] timeval struct incorrect?

查看:92
本文介绍了timeval结构不正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

timeval结构未由opengroup定义,请参见http://www.opengroup.org/onlinepubs/007908799/xsh/systime.h.html .在Windows 64位上,time_t为64位,长为32位. timeval结构应使用time_t,否则将来随着时间的推移也会出现问题.

The timeval struct is not defined as by the opengroup, see http://www.opengroup.org/onlinepubs/007908799/xsh/systime.h.html. time_t is 64bit on windows 64bit, long is 32bit. The timeval struct should use time_t, else we also get a problem in the future with time.

推荐答案

我也遇到了这个问题.我的应用程序广泛使用Timeval结构,并将其用于对localtime()等的调用. ].它在VC6中工作,因为其中的Time_t类型很长.但是现在,它在 VC8,因为VC8中的Time_T类型为__int64.它编译成功,但在运行时崩溃.

I am also facing this problem. My application uses Timeval structure extensively and uses it in calls to localtime() etc. [eg : struct tm *ttm = localtime(&(tv.tv_sec)); ]. It works in VC6 as type of Time_t was long in it. But now, it does not work in VC8, as type of Time_T in VC8 is __int64.  It compiles successfully, but crashes at runtime.

 

是否有正确的时间结构定义?

Is a correct definition of timeval structure available?


这篇关于timeval结构不正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆