Skip to content

Commit

Permalink
- use international date format for all places that print a date.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
coelckers committed Mar 11, 2019
1 parent 22cf35c commit 8b4690b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
9 changes: 2 additions & 7 deletions src/g_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2054,7 +2054,7 @@ void G_DoAutoSave ()
}

readableTime = myasctime ();
description.Format("Autosave %.12s", readableTime + 4);
description.Format("Autosave %s", readableTime);
G_DoSaveGame (false, file, description);
}

Expand All @@ -2077,14 +2077,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);

Expand Down
6 changes: 4 additions & 2 deletions src/utility/cmdlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,18 +426,20 @@ void FormatGUID (char *buffer, size_t buffsize, const GUID &guid)

const char *myasctime ()
{
static char readabletime[50];
time_t clock;
struct tm *lt;

time (&clock);
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";
}
}

Expand Down
4 changes: 2 additions & 2 deletions wadsrc/static/zscript/ui/menu/loadsavemenu.zs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ class LoadSaveMenu : ListMenu
}
else
{
String s = mInput.GetText() .. ConFont.GetCursor();
int length = ConFont.StringWidth(s) * CleanXFac;
String s = mInput.GetText() .. NewConsoleFont.GetCursor();
int length = NewConsoleFont.StringWidth(s) * FontScale;
int displacement = min(0, listboxWidth - 2 - length);
screen.DrawText (NewConsoleFont, Font.CR_WHITE, (listboxLeft + 1 + displacement) / FontScale, (listboxTop+rowHeight*i + FontScale) / FontScale, s,
DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale);
Expand Down

0 comments on commit 8b4690b

Please sign in to comment.