Sign-up....

_time64_t是不是时间的类型?

刚才在MSDN上面查到的

struct __timeb64 tstruct;

_tzset();

/* Get UNIX-style time and display as number and string. */

_time64( <ime );

printf( "Time in seconds since UTC 1/1/70:\t%ld\n", ltime );

可是自己编译的时候老是出错呢?

error C2065: 'time64_t' : undeclared identifier

error C2146: syntax error : missing ';' before identifier 'ltime'

error C2065: 'ltime' : undeclared identifier

warning C4013: 'time64' undefined; assuming extern returning int

warning C4013: '_time64' undefined; assuming extern returning int

[572 byte] By [msdn] at [2007-8-14 20:04:50]
# 1 Re: _time64_t是不是时间的类型?

楼主用的是VC6吧,在VC.net下是正常的

nasi00 at 2005-6-19 14:17:42 >
# 2 Re: _time64_t是不是时间的类型?

没有包含正确的头文件就会这样……

#include <time.h>

newbiestar at 2005-6-19 14:34:20 >
# 3 Re: _time64_t是不是时间的类型?

目前只有VC.NET(VC7.0以上)支持struct __timeb64

keiy at 2005-6-19 15:00:30 >
# 4 Re: _time64_t是不是时间的类型?

time64_t是UNIX的C定义的类型,UNIX的机器很多都是64位的。

megaboy at 2005-6-19 17:22:13 >
# 5 Re: _time64_t是不是时间的类型?

我用的是VC6啊,哪应该怎么得到系统时间呢?

谢谢

soubrina at 2005-6-20 2:21:24 >
# 6 Re: _time64_t是不是时间的类型?

你用的是.net可以用你上面的定义方式,在vc下直接用time即可.

wkjs at 2005-6-20 2:36:47 >
# 7 Re: _time64_t是不是时间的类型?

这个问题可以解决的

例如:

long long a;

OpenHero at 2005-6-20 2:36:54 >
# 8 Re: _time64_t是不是时间的类型?

现在改成这样了。。。。。。。。但是时间的类型还是不对,应该不是time吧。。。。。。。time只是得到系统时间的函数。。。。那里面的参数应该是什么类型呢?

time ltime;

tzset();

time( <ime );

printf( "Time in seconds since UTC 1/1/70:\t%ld\n", ltime );

soubrina at 2005-6-20 5:17:31 >
# 9 Re: _time64_t是不是时间的类型?

时间类型不是time,而是time_t,time_t是由long派生的,具体你的机器是不是long,打开time.h文件看看就知道了,要做成64位的,直接用long long就得了。

megaboy at 2005-6-20 6:59:12 >
# 10 Re: _time64_t是不是时间的类型?

VC6不支持long long,

#include <time.h>

...

time_t ltime;

tzset();

time( <ime );

printf( "Time in seconds since UTC 1/1/70:\t%d\n", ltime );

就可以了

keiy at 2005-6-20 8:35:35 >

C/C++

All Classified