#### Archived

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

# 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 on other sites
GetSystemTime? GetLocalTime? time? gmtime? localtime?
this question begs for an RTFM reply so much it's not even funny.

[edited by - niyaw on October 31, 2002 10:08:51 PM]

##### Share on other sites
See timeGetSystemTime();

I don''t have a signature

##### 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

• ### Forum Statistics

• Total Topics
628385
• Total Posts
2982391

• 10
• 9
• 15
• 24
• 11