Archived

This topic is now archived and is closed to further replies.

da_cobra

how to get the system time

Recommended Posts

I use the visual c++ and I have a structure : struct time {int hours ; int minutes ; int seconds ; } ; now how do I read the system time and put it into that structure I already found how to read the system time and put it into a string, but I need it in that srtucture, so I can acces the hours, minutes and seconds by themself thanx in advance

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Why not use the SYSTEMTIME structure:

SYSTEMTIME st;
GetSystemTime (&st);
cout << st.wHour << '':'' << st.wMinute << '':'' << st.wSecond;

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
How about getting the localtime() instead of getting system time and converting it according to local timezone?

Share this post


Link to post
Share on other sites