mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-10-31 15:20:10 +00:00
Remove use of gmtime and asctime
This commit is contained in:
parent
844322c5a8
commit
fbfbaa118a
@ -457,8 +457,9 @@ char *CrashLog::FillCrashLog(char *buffer, const char *last)
|
||||
|
||||
buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i, %i) (DL: %u)\n", _cur_date_ymd.year, _cur_date_ymd.month + 1, _cur_date_ymd.day, _date_fract, _tick_skip_counter, _settings_game.economy.day_length_factor);
|
||||
if (_game_load_time != 0) {
|
||||
buffer += seprintf(buffer, last, "Game loaded at: %i-%02i-%02i (%i, %i), %s",
|
||||
_game_load_cur_date_ymd.year, _game_load_cur_date_ymd.month + 1, _game_load_cur_date_ymd.day, _game_load_date_fract, _game_load_tick_skip_counter, asctime(gmtime(&_game_load_time)));
|
||||
buffer += seprintf(buffer, last, "Game loaded at: %i-%02i-%02i (%i, %i), ",
|
||||
_game_load_cur_date_ymd.year, _game_load_cur_date_ymd.month + 1, _game_load_cur_date_ymd.day, _game_load_date_fract, _game_load_tick_skip_counter);
|
||||
buffer += UTCTime::Format(buffer, last, _game_load_time, "%Y-%m-%d %H:%M:%S");
|
||||
}
|
||||
buffer += seprintf(buffer, last, "\n");
|
||||
|
||||
@ -508,10 +509,10 @@ char *CrashLog::FillCrashLog(char *buffer, const char *last)
|
||||
*/
|
||||
char *CrashLog::FillDesyncCrashLog(char *buffer, const char *last, const DesyncExtraInfo &info) const
|
||||
{
|
||||
time_t cur_time = time(nullptr);
|
||||
buffer += seprintf(buffer, last, "*** OpenTTD Multiplayer %s Desync Report ***\n\n", _network_server ? "Server" : "Client");
|
||||
|
||||
buffer += seprintf(buffer, last, "Desync at: %s", asctime(gmtime(&cur_time)));
|
||||
buffer += UTCTime::Format(buffer, last, "Desync at: %Y-%m-%d %H:%M:%S (UTC)\n");
|
||||
|
||||
if (!_network_server && info.flags) {
|
||||
auto flag_check = [&](DesyncExtraInfo::Flags flag, const char *str) {
|
||||
return info.flags & flag ? str : "";
|
||||
@ -531,8 +532,9 @@ char *CrashLog::FillDesyncCrashLog(char *buffer, const char *last, const DesyncE
|
||||
buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i, %i) (DL: %u), %08X\n",
|
||||
_cur_date_ymd.year, _cur_date_ymd.month + 1, _cur_date_ymd.day, _date_fract, _tick_skip_counter, _settings_game.economy.day_length_factor, _frame_counter);
|
||||
if (_game_load_time != 0) {
|
||||
buffer += seprintf(buffer, last, "Game loaded at: %i-%02i-%02i (%i, %i), %s",
|
||||
_game_load_cur_date_ymd.year, _game_load_cur_date_ymd.month + 1, _game_load_cur_date_ymd.day, _game_load_date_fract, _game_load_tick_skip_counter, asctime(gmtime(&_game_load_time)));
|
||||
buffer += seprintf(buffer, last, "Game loaded at: %i-%02i-%02i (%i, %i), ",
|
||||
_game_load_cur_date_ymd.year, _game_load_cur_date_ymd.month + 1, _game_load_cur_date_ymd.day, _game_load_date_fract, _game_load_tick_skip_counter);
|
||||
buffer += UTCTime::Format(buffer, last, _game_load_time, "%Y-%m-%d %H:%M:%S");
|
||||
}
|
||||
if (!_network_server) {
|
||||
extern Date _last_sync_date;
|
||||
@ -582,10 +584,9 @@ char *CrashLog::FillDesyncCrashLog(char *buffer, const char *last, const DesyncE
|
||||
*/
|
||||
char *CrashLog::FillInconsistencyLog(char *buffer, const char *last, const InconsistencyExtraInfo &info) const
|
||||
{
|
||||
time_t cur_time = time(nullptr);
|
||||
buffer += seprintf(buffer, last, "*** OpenTTD Inconsistency Report ***\n\n");
|
||||
|
||||
buffer += seprintf(buffer, last, "Inconsistency at: %s", asctime(gmtime(&cur_time)));
|
||||
buffer += UTCTime::Format(buffer, last, "Inconsistency at: %Y-%m-%d %H:%M:%S (UTC)\n");
|
||||
|
||||
#ifdef USE_SCOPE_INFO
|
||||
buffer += WriteScopeLog(buffer, last);
|
||||
@ -596,8 +597,9 @@ char *CrashLog::FillInconsistencyLog(char *buffer, const char *last, const Incon
|
||||
buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i, %i) (DL: %u), %08X\n",
|
||||
_cur_date_ymd.year, _cur_date_ymd.month + 1, _cur_date_ymd.day, _date_fract, _tick_skip_counter, _settings_game.economy.day_length_factor, _frame_counter);
|
||||
if (_game_load_time != 0) {
|
||||
buffer += seprintf(buffer, last, "Game loaded at: %i-%02i-%02i (%i, %i), %s",
|
||||
_game_load_cur_date_ymd.year, _game_load_cur_date_ymd.month + 1, _game_load_cur_date_ymd.day, _game_load_date_fract, _game_load_tick_skip_counter, asctime(gmtime(&_game_load_time)));
|
||||
buffer += seprintf(buffer, last, "Game loaded at: %i-%02i-%02i (%i, %i), ",
|
||||
_game_load_cur_date_ymd.year, _game_load_cur_date_ymd.month + 1, _game_load_cur_date_ymd.day, _game_load_date_fract, _game_load_tick_skip_counter);
|
||||
buffer += UTCTime::Format(buffer, last, _game_load_time, "%Y-%m-%d %H:%M:%S");
|
||||
}
|
||||
if (_networking && !_network_server) {
|
||||
extern Date _last_sync_date;
|
||||
@ -812,8 +814,7 @@ bool CrashLog::MakeCrashLog(char *buffer, const char *last)
|
||||
crashlogged = true;
|
||||
|
||||
char *name_buffer_date = this->name_buffer + seprintf(this->name_buffer, lastof(this->name_buffer), "crash-");
|
||||
time_t cur_time = time(nullptr);
|
||||
strftime(name_buffer_date, lastof(this->name_buffer) - name_buffer_date, "%Y%m%dT%H%M%SZ", gmtime(&cur_time));
|
||||
UTCTime::Format(name_buffer_date, lastof(this->name_buffer), "%Y%m%dT%H%M%SZ");
|
||||
|
||||
#ifdef DEDICATED
|
||||
if (!_settings_client.gui.keep_all_autosave) {
|
||||
@ -912,8 +913,7 @@ bool CrashLog::MakeDesyncCrashLog(const std::string *log_in, std::string *log_ou
|
||||
|
||||
char name_buffer[64];
|
||||
char *name_buffer_date = name_buffer + seprintf(name_buffer, lastof(name_buffer), "desync-%s-", mode);
|
||||
time_t cur_time = time(nullptr);
|
||||
strftime(name_buffer_date, lastof(name_buffer) - name_buffer_date, "%Y%m%dT%H%M%SZ", gmtime(&cur_time));
|
||||
UTCTime::Format(name_buffer_date, lastof(this->name_buffer), "%Y%m%dT%H%M%SZ");
|
||||
|
||||
printf("Desync encountered (%s), generating desync log...\n", mode);
|
||||
char *b = this->FillDesyncCrashLog(buffer, last, info);
|
||||
@ -982,8 +982,7 @@ bool CrashLog::MakeInconsistencyLog(const InconsistencyExtraInfo &info) const
|
||||
|
||||
char name_buffer[64];
|
||||
char *name_buffer_date = name_buffer + seprintf(name_buffer, lastof(name_buffer), "inconsistency-");
|
||||
time_t cur_time = time(nullptr);
|
||||
strftime(name_buffer_date, lastof(name_buffer) - name_buffer_date, "%Y%m%dT%H%M%SZ", gmtime(&cur_time));
|
||||
UTCTime::Format(name_buffer_date, lastof(this->name_buffer), "%Y%m%dT%H%M%SZ");
|
||||
|
||||
printf("Inconsistency encountered, generating diagnostics log...\n");
|
||||
this->FillInconsistencyLog(buffer, last, info);
|
||||
|
@ -700,8 +700,7 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
|
||||
CrashLogWindows::current = log;
|
||||
char *buf = log->FillCrashLog(log->crashlog, lastof(log->crashlog));
|
||||
char *name_buffer_date = log->name_buffer + seprintf(log->name_buffer, lastof(log->name_buffer), "crash-");
|
||||
time_t cur_time = time(nullptr);
|
||||
strftime(name_buffer_date, lastof(log->name_buffer) - name_buffer_date, "%Y%m%dT%H%M%SZ", gmtime(&cur_time));
|
||||
UTCTime::Format(name_buffer_date, lastof(this->name_buffer), "%Y%m%dT%H%M%SZ");
|
||||
log->WriteCrashDump(log->crashdump_filename, lastof(log->crashdump_filename));
|
||||
log->AppendDecodedStacktrace(buf, lastof(log->crashlog));
|
||||
log->WriteCrashLog(log->crashlog, log->crashlog_filename, lastof(log->crashlog_filename), log->name_buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user