+ 2

Is there any code to find the current date and time of the system ...in c++

date/time in c++

8th Jun 2017, 5:23 PM
SatanicAngal666
SatanicAngal666 - avatar
9 Answers
+ 7
That is OS dependant....but for Windows you can use QueryPerformanceCounter().
8th Jun 2017, 5:42 PM
Karl T.
Karl T. - avatar
+ 6
#include <windows.h> LARGE_INTEGER freq, t1,t2; QueryPerformanceFrequency((LARGE_INTEGER*)&freq); QueryPerformanceCounter((LARGE_INTEGER*)&t1); QueryPerformanceCounter((LARGE_INTEGER*)&t2); double elapsedTime= (double) ((t2.QuadPart - t1.QuadPart) / freq.QuadPart);
8th Jun 2017, 5:58 PM
Karl T.
Karl T. - avatar
+ 5
I've just posted the minimum code, I can't put the entire Windows code here it is way too long.
8th Jun 2017, 6:07 PM
Karl T.
Karl T. - avatar
+ 5
main() is a console application, not windows.
8th Jun 2017, 6:09 PM
Karl T.
Karl T. - avatar
+ 1
I used this code void printbuilddatetime(){ cout<<__TIMESTAMP__<<endl; } int main() { printbuilddatetime(); }
8th Jun 2017, 6:07 PM
SatanicAngal666
SatanicAngal666 - avatar
0
I am using dev c++ GUI environment..
8th Jun 2017, 5:47 PM
SatanicAngal666
SatanicAngal666 - avatar
0
can you please write the full code of this!
8th Jun 2017, 5:47 PM
SatanicAngal666
SatanicAngal666 - avatar
0
it is not working. ....
8th Jun 2017, 6:01 PM
SatanicAngal666
SatanicAngal666 - avatar
0
you are right....... thanks for the code...
8th Jun 2017, 6:15 PM
SatanicAngal666
SatanicAngal666 - avatar