localtime crash fix (updated from EQ2emu revision)
Replaces commit e5876f9a10
with the official revision change to fix https://svn.eq2emulator.net/!/#eq2server/commit/r2852/head/trunk
This commit is contained in:
parent
76681f430f
commit
5333c294c9
1 changed files with 13 additions and 14 deletions
|
@ -138,28 +138,27 @@ void EQPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
|||
{
|
||||
if (timestamp.tv_sec) {
|
||||
char temp[20];
|
||||
struct tm* info = localtime((const time_t*)×tamp.tv_sec);
|
||||
if (info)
|
||||
strftime(temp, 20, "%F %T", info);
|
||||
else
|
||||
_snprintf(temp, 20, "[UNKNOWNTIME]");
|
||||
|
||||
fprintf(to, "%s.%06lu ",temp,timestamp.tv_usec);
|
||||
tm t;
|
||||
const time_t sec = timestamp.tv_sec;
|
||||
localtime_s(&t, &sec);
|
||||
strftime(temp, 20, "%F %T", &t);
|
||||
fprintf(to, "%s.%06lu ", temp, timestamp.tv_usec);
|
||||
}
|
||||
if (src_ip) {
|
||||
string sIP,dIP;;
|
||||
sIP=long2ip(src_ip);
|
||||
dIP=long2ip(dst_ip);
|
||||
fprintf(to, "[%s:%d->%s:%d]\n",sIP.c_str(),src_port,dIP.c_str(),dst_port);
|
||||
string sIP, dIP;;
|
||||
sIP = long2ip(src_ip);
|
||||
dIP = long2ip(dst_ip);
|
||||
fprintf(to, "[%s:%d->%s:%d]\n", sIP.c_str(), src_port, dIP.c_str(), dst_port);
|
||||
}
|
||||
if (seq != 0xffff)
|
||||
fprintf(to, "[Seq=%u] ",seq);
|
||||
fprintf(to, "[Seq=%u] ", seq);
|
||||
string name;
|
||||
int16 OpcodeVersion = GetOpcodeVersion(version);
|
||||
if(EQOpcodeManager.count(OpcodeVersion) > 0)
|
||||
if (EQOpcodeManager.count(OpcodeVersion) > 0)
|
||||
name = EQOpcodeManager[OpcodeVersion]->EQToName(opcode);
|
||||
fprintf(to, "[OpCode 0x%04x (%s) Size=%u]\n",opcode,name.c_str(),size);
|
||||
fprintf(to, "[OpCode 0x%04x (%s) Size=%u]\n", opcode, name.c_str(), size);
|
||||
}
|
||||
|
||||
const char* EQPacket::GetOpcodeName(){
|
||||
int16 OpcodeVersion = GetOpcodeVersion(version);
|
||||
if(EQOpcodeManager.count(OpcodeVersion) > 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue