'How to convert CTime to integer?
I need to get modify date from a file.
CFileStatus stat;
CFile::GetStatus(strFilePath, stat);
It returns 1585557924 to be CTime. (it look like a timestamp)
stat.m_mtime
I have a lot of file and I need to get modify date from each file as timestamp then sum all timestamp.
But It cannot convert stat.m_mtime to integer.
int sum_timestamp = 0;
sum_timestamp += (int)stat.m_mtime;
It error like these.
'no suitable conversion function from "ATL::CTime"to"int"exists'
Solution 1:[1]
Assuming you are compiling in 64 bits, you can get a unix timestamp from CTime using GetTime(), which is is a __time64_t_ (= __int64 = long long).
Ex:
long long sum_timestamp = 0;
sum_timestamp += stat.m_mtime.GetTime();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kiruahxh |
