C++ 当前时间毫秒数转换为4字节十六进制
如题,1970-01-01到现在的毫秒数据的4字节十六进制表示。
求高人指点。
[解决办法]
long ltime;
_time32(<ime);
printf("%x",ltime);
#include <time.h>
#include <stdio.h>
unsigned long sec = time(NULL);
//c
printf(" %lx\n", sec);
//c++
cout << hex << sec << endl;
The wDayOfWeek member of the SYSTEMTIME structure is ignored.
lpFileTime
Pointer to a FILETIME structure to receive the converted system time.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
FILETIME
The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601.
typedef struct _FILETIME { // ft
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
Members
dwLowDateTime
Specifies the low-order 32 bits of the file time.
dwHighDateTime
Specifies the high-order 32 bits of the file time.
Remarks
It is not recommended that you add and subtract values from the FILETIME structure to obtain relative times. Instead, you should
Copy the resulting FILETIME structure to a LARGE_INTEGER structure.
Use normal 64-bit arithmetic on the LARGE_INTEGER value.
[解决办法]