I am looking to have the core set a value in the char_var SQL table on disconnects. What I am trying to do is that when a user disconnects, it sets the epoch current time when the disconnect happens into the character variable table for tracking purposes. Currently to ensure that the time is being counted properly, I have setup a variable called dotime and when I print that variable with show warning, it shows the correct epoch time (example: 1482353944) . However, in the SQL table, it shows a completely different number (1001279688). I figure I am using the wrong integer type or something else is going wrong. Below is the code that I am using in map.cpp two lines under where the Pchar status is STATUS_SHUTDOWN
Code: Select all
uint32 dotime = (uint32)time(nullptr);
ShowWarning(CL_RED"Epoch Time Received %u.\n" CL_RESET, dotime);
std::string varname;
const int8* fmtQuery = "INSERT INTO char_vars SET charid = %u, varname = 'disconnect', value = %u ON DUPLICATE KEY UPDATE value = %u;";
Sql_Query(SqlHandle, fmtQuery, PChar->id, varname, dotime, dotime);