c++ - 什么是 CTime(有没有)32 位模拟?

标签 c++ mfc atl

我发现<time.h>里面有ctime和_ctime_32但 ctime 也不是 CTime。有 CTime 32 位模拟吗?或者可能是带有 __time32_t 的 32 位 CTime。我在使用 64 位版本时遇到了兼容性问题。

好吧,也许我根本不需要 CTime,我正在接收 __time32_t 并使用它来提供变量时间:

SYSTEMTIME st;
   CTime tmp =  pCurPar[pot->numSubsection].SysTime;
      tmp.GetAsSystemTime( st );
    SystemTimeToVariantTime(&st,&pot->Value.date);

但我觉得

CTime tmp =  pCurPar[pot->numSubsection].SysTime;

转换不正确,因为我的 .SysTime 是 __time32_t 并且 CTime 使用的是 64 位版本。

即使我遇到一种情况,我需要将其作为 time32_t 提供,但使用 pot->Value.intVal = DayRec[pot->numSubsection].startTime.GetTime();我有警告 Warning 3 warning C4244: '=' : conversion from '__time64_t' to 'INT', possible loss of data

最佳答案

我只有 Visual Studio Express 无法测试,但编译器应该不会自动将 32 位类型转换为 64 位类型吗?以相反的方式进行操作会导致精度下降的警告,但 32 位到 64 位的转换应该不是问题。测试一下,不行再回来。

关于c++ - 什么是 CTime(有没有)32 位模拟?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8499871/

相关文章:

c++ - vector : namespace std 的重载运算符 +

c++ - 如何在不发生冲突的情况下快速散列非常大的子串?

c++ - 显示对话框后无法将焦点返回到主窗口

c# - C++ MFC 与 .NET?

c++ - 将 BSTR 转换为 LPCWSTR

c++ - 2019 年使用 C++20

android - 编译时使用 Boost for Android 会抛出错误

python - 我的 MFC C++ .dll 的多线程

c++ - 为什么我在以受限用户身份运行时会在 DLLMain 中获得 GPF?

com - 杀死系统帐户下的 ATL COM 进程?