比如一个LPSYSTEMTIME,要得到它加上8小时后的LPSYSTEMTIME,有什么api吗??
没做过,但帮助中有相关说明:
Remarks
It is not recommended that you add and subtract values from this structure to obtain relative times.
The following list shows tasks to perform instead:
Convert the SYSTEMTIME structure to a FILETIME structure.
Copy the resulting FILETIME structure to a ULARGE_INTEGER structure.
Use usual 64-bit arithmetic on the ULARGE_INTEGER value.
LZ要做timezone转换?
GetSystemTime(...);
呵呵,本地时区使用 GetLocalTime 函数
取得的就是北京时间,不需要转换了。
这个问题问倒我了,其实就是个时间进位问题,建议你用转换为FILETIME之后再操作
Millisecond granularity may not be supported by a hardware platform. The caller of this function should not rely on more than second granularity. It is not recommended that you add and subtract values from this structure to obtain relative times.
The following list shows tasks to perform instead:
Convert the SYSTEMTIME structure to a FILETIME structure.
Copy the resulting FILETIME structure to a ULARGE_INTEGER structure.
Use usual 64-bit arithmetic on the ULARGE_INTEGER value.
引用: 引用 3 楼 zaodt 的回复:
呵呵,本地时区使用 GetLocalTime 函数
取得的就是北京时间,不需要转换了。
然后用CString 格式化的时候 操作一下具体的时间 就对了