Server Help

Bot Questions - local time?

tikiman - Mon Mar 03, 2003 1:35 am
Post subject: local time?
Is there any way to obtain the actual time for logging purposes?
Anonymous - Mon Mar 03, 2003 2:13 pm
Post subject: example
heres an example how to do that: (squadA and squadB are examples)

// create log file name
char u[100];
time_t t=time(NULL);
tm *tmp = localtime(&t);
strftime(u,99,"%y",tmp);
logname = "c:\\logs\\";
logname += u;
logname += "y";
strftime(u,99,"%m",tmp);
logname += u;
logname += "m";
strftime(u,99,"%d",tmp);
logname += u;
logname += "d";
logname += squadA;
logname += " vs ";
logname += squadB;
strftime(u,99,"%I",tmp);
logname += u;
logname += "h";
strftime(u,99,"%M",tmp);
logname += u;
logname += "m";
logname += ".txt";

// create log file
ofstream outf(logname);
Anonymous - Mon Mar 03, 2003 2:14 pm
Post subject: and
if squadA/squadB are Sandstorm/Fearless, the code would create

03y03m01dSandstorm vs Fearless08h01m.txt
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group