options: extended the snapname templates to allow for a timestamp %t option, so to allow for alternate ways to organize the generated snaps.

This commit is contained in:
etabeta78 2021-04-29 15:34:02 +02:00 committed by GitHub
parent 97d978dd8f
commit d0d8110ecd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1169,6 +1169,18 @@ osd_file::error video_manager::open_next(emu_file &file, const char *extension,
}
}
// handle %t in the template (for timestamp)
std::string snaptime("%t");
int pos_time = snapstr.find(snaptime);
if (pos_time != -1)
{
char t_str[15];
const std::time_t cur_time = std::time(nullptr);
strftime(t_str, sizeof(t_str), "%Y%m%d_%H%M%S", std::localtime(&cur_time));
strreplace(snapstr, "%t", t_str);
}
// add our own extension
snapstr.append(".").append(extension);