[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Improved gnubg filenaming convention - suggestion
From: |
Philippe Michel |
Subject: |
Re: Improved gnubg filenaming convention - suggestion |
Date: |
Thu, 18 Jan 2024 23:48:12 +0100 |
On Thu, Jan 18, 2024 at 02:08:23PM +0000, Ian Shaw via Bug reports for and
general discussion about GNU Backgammon. wrote:
> The file file.c has a function GetFilename which includes the line
>
> if (mi.nYear)
> sz = g_strdup_printf("%s-%s_%dp_%04u-%02u-%02u.sgf",
> ap[0].szName, ap[1].szName, ms. nMatchTo, mi.nYear, mi.nMonth, mi.nDay);
>
>
> I couldn’t find where mi is set, but if it includes the parameters nHour and
> nMinute it would be easy to add these to the name.
mi is the match information that can be set with File|Match Information
; there are no time information there, only the date.
> The else condition of (mi.nYear) contains code that does appear to use the
> hour and minute, so it looks like there might be some inconsistency:
>
> if (strftime(tstr, 14, "%Y-%m-%d-%H%M", localtime(&t)) == 0)
> *tstr = '\0';
>
> sz = g_strdup_printf("%s-%s_%dp_%s.sgf", ap[0].szName,
> ap[1].szName, ms.nMatchTo, tstr);
One would need to look at the commits history to be sure, but it somehow
looks like file names similar to what Wayne suggests were once used by
default, when there was no match information manually entered, but at
some point it was decided to automatically fill as much as possible of
the latter (the player names and the date) and as a side effect the else
branch of the piece of code you quote is never taken any more.
The proposed file name change (adding the time, I'm more skeptical about
the error rate information) looks sensible, but it seems that it will be
a bit more complicated that just changing a format string.