使用 TDateTime EncodeTime 函数的编译器错误
Compiler error using TDateTime EncodeTime function
我在 Windows 10 家庭版 1903 上使用 C++Builder 10.3.2 社区版。
我尝试使用下面的 Remy 代码来获取 UTC date/time。
编译时bcc32c报错:
no matching function for call to 'EncodeTime'.
对 EncodeDate 的调用有效。
我在 Vista 上的 C++Builder 5 中使用了完全相同的代码,它工作正常。
我一直在尝试寻找这个问题的参考,但没有成功。我错过了什么吗?
TDateTime __fastcall NowUTC(void)
{
SYSTEMTIME SystemTime;
::GetSystemTime(&SystemTime);
return EncodeDate(SystemTime.wYear,SystemTime.wMonth,SystemTime.wDay) + EncodeTime(SystemTime.wHour,SystemTime.wMinute,SystemTime.wSecond);
}
EncodeTime 需要添加毫秒数。试试这一行:
return EncodeDate(SystemTime.wYear,SystemTime.wMonth,SystemTime.wDay)+ EncodeTime(SystemTime.wHour,SystemTime.wMinute,SystemTime.wSecond,SystemTime.wMilliseconds);
我在 Windows 10 家庭版 1903 上使用 C++Builder 10.3.2 社区版。
我尝试使用下面的 Remy 代码来获取 UTC date/time。
编译时bcc32c报错:
no matching function for call to 'EncodeTime'.
对 EncodeDate 的调用有效。
我在 Vista 上的 C++Builder 5 中使用了完全相同的代码,它工作正常。
我一直在尝试寻找这个问题的参考,但没有成功。我错过了什么吗?
TDateTime __fastcall NowUTC(void)
{
SYSTEMTIME SystemTime;
::GetSystemTime(&SystemTime);
return EncodeDate(SystemTime.wYear,SystemTime.wMonth,SystemTime.wDay) + EncodeTime(SystemTime.wHour,SystemTime.wMinute,SystemTime.wSecond);
}
EncodeTime 需要添加毫秒数。试试这一行:
return EncodeDate(SystemTime.wYear,SystemTime.wMonth,SystemTime.wDay)+ EncodeTime(SystemTime.wHour,SystemTime.wMinute,SystemTime.wSecond,SystemTime.wMilliseconds);