|
-
May 27th, 1999, 08:30 AM
#1
How to get system date&time by no using MFC (CTime, etc)?
Does anybody know C/C++ function to obtain system date and time by not using MFC? (which allow achieve same result as CTime::GetCurrentTime())
-
May 27th, 1999, 09:46 AM
#2
Re: How to get system date&time by no using MFC (CTime, etc)?
This should do what you need
#include <time.h>
{
time_t t;
t = time(NULL);
tm *timeinfo;
timeinfo = gmtime(&t);
//timeinfo.tm_sec; /*int seconds after the minute - [0,59] */
//timeinfo.tm_min; /*int minutes after the hour - [0,59] */
//timeinfo.tm_hour; /*int hours since midnight - [0,23] */
//timeinfo.tm_mday; /*int day of the month - [1,31] */
//timeinfo.tm_mon; /*int months since January - [0,11] */
//timeinfo.tm_year; /*int years since 1900 */
//timeinfo.tm_wday; /*int days since Sunday - [0,6] */
//timeinfo.tm_yday; /*int days since January 1 - [0,365] */
//timeinfo.tm_isdst; /*int daylight savings time flag */
}
HTH,
Chris
-
May 27th, 1999, 10:10 AM
#3
Re: How to get system date&time by no using MFC (CTime, etc)?
If you are in windows You can use ::GetSystemTime()
Ramanan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|