Archived

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

DevLiquidKnight

Getting system time..

Recommended Posts

Im trying to figure out how does one go about getting the system time on a computer. I am not using MFC I need to do this in my game because I will be using it deteramin if the world should be night or day. Anyone know how I could do this? Like just the basic info for getting system time. Perferaly not just some number that is used to deteramin time... But to actually find out if it is 2:30 Don''t click me! Killer Eagle Software

Share this post


Link to post
Share on other sites
Here''s my exact code for getting the system time (from my CGI proggy: )

  
char* GetTime(char* szBuff)
{
time_t theTime;
tm* pTime;

theTime = time(NULL);
pTime = localtime(&theTime);
sprintf(szBuff,"%02d:%02d:%02d",pTime->tm_hour,pTime->tm_min,pTime->tm_sec);
return szBuff;
}


HTH,
Steve

Steve
DirectX Programmer
Soon to be the new Bill Gates

Share this post


Link to post
Share on other sites