Skip to main content
gamedev.net
🔒 Locked

Getting system time..

Started by DevLiquidKnight Oct 31, 2002 at 3:41 PM 2 replies 350+ views
Original Post
DevLiquidKnight
DevLiquidKnight
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
Brian Jones
Brian Jones
See timeGetSystemTime();

I don''t have a signature
I don't have a signature
Evil Bill
Evil Bill
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
Member of the Unban Mindwipe Society (UMWS)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.