From 3583cb1fe5189578c5ddccf830c56626c43dad44 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 11 Mar 2019 21:21:37 +0100 Subject: [PATCH] - use international date format for all places that print a date. The most important one is the autosave tagging. This was done because the old printout was missing the year and printed the month as a 3 character English string, sabotaging any attempt to sort the autosaves by anything meaningful. --- src/cmdlib.cpp | 6 ++++-- src/g_game.cpp | 9 ++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/cmdlib.cpp b/src/cmdlib.cpp index 5d3c5ca87..db484c7aa 100644 --- a/src/cmdlib.cpp +++ b/src/cmdlib.cpp @@ -418,6 +418,7 @@ void FormatGUID (char *buffer, size_t buffsize, const GUID &guid) const char *myasctime () { + static char readabletime[50]; time_t clock; struct tm *lt; @@ -425,11 +426,12 @@ const char *myasctime () lt = localtime (&clock); if (lt != NULL) { - return asctime (lt); + strftime(readabletime, 50, "%F %T", lt); + return readabletime; } else { - return "Pre Jan 01 00:00:00 1970\n"; + return "Unknown\n"; } } diff --git a/src/g_game.cpp b/src/g_game.cpp index 7ad779065..9c7f4ea2f 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2073,7 +2073,7 @@ void G_DoAutoSave () } readableTime = myasctime (); - description.Format("Autosave %.12s", readableTime + 4); + description.Format("Autosave %s", readableTime); G_DoSaveGame (false, file, description); } @@ -2096,14 +2096,9 @@ static void PutSaveWads (FSerializer &arc) static void PutSaveComment (FSerializer &arc) { - const char *readableTime; int levelTime; - // Get the current date and time - readableTime = myasctime (); - - FString comment; - comment.Format("%.10s%.5s%.9s", readableTime, &readableTime[19], &readableTime[10]); + FString comment = myasctime(); arc.AddString("Creation Time", comment);