#include <iostream>
#include <time.h>
using namespace std;
void main()
{
float time;
time = time();
cout << time;
}
How do I get the current time?
How can I get the current time? I tried something simple like this but I couldn''t get it to work. I could''t find any documentation on it either but I probably didnt look in the right place. Thanks.
Try the C version (probably you should use ctime and std:: for C++)
or Win32 version
[edited by - IndirectX on June 7, 2002 12:27:48 AM]
#include <time.h>time_t time;time(&time);struct tm current_time = *localtime(&time);
or Win32 version
SYSTEMTIME CurrentTime;GetSystemTime(&CurrentTime);
[edited by - IndirectX on June 7, 2002 12:27:48 AM]
---visit #directxdev on afternet <- not just for directx, despite the name
Look up preprocessor definitions __TIME__, __TIMESTAMP__, __DATE__, et al.
Good luck!
MatrixCubed
http://MatrixCubed.cjb.net
Good luck!
MatrixCubed
http://MatrixCubed.cjb.net
[ Odyssey Project ]
quote: Original post by MatrixCubed
Look up preprocessor definitions __TIME__, __TIMESTAMP__, __DATE__, et al.
These macros will give you the compile timestamp, not the current time at program execution.
---visit #directxdev on afternet <- not just for directx, despite the name
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement