diff options
author | Bennett Goble <signal@lindenlab.com> | 2024-04-27 10:49:31 -0700 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-03-11 22:25:33 +0200 |
commit | 851039cf4ed0de89b3a79b1e12483879a120576c (patch) | |
tree | 4ae54d8cdaf7998a7dd4610f3b6d800cc39d0414 /indra/newview/llviewerwindow.cpp | |
parent | 89a87fbf81353e9143750bf5389236a45afc9f9a (diff) |
Add timestamp to snapshot file names
This changeset adds a timestamp in the format of "YYYY-MM-DD_HHSS" to
snapshot filenames. This is useful for understanding when a snapshot was
taken, chronologically ordering files, and is less confusing than the
current method of adding a number to the snapshot name, as it does not
result in interleaving of old and new snapshots inside a directory.
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 2d9f73115e..5554ac2514 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -66,6 +66,7 @@ #include "llchatentry.h" #include "indra_constants.h" #include "llassetstorage.h" +#include "lldate.h" #include "llerrorcontrol.h" #include "llfontgl.h" #include "llmousehandler.h" @@ -4806,26 +4807,23 @@ void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_save } // Look for an unused file name - bool is_snapshot_name_loc_set = isSnapshotLocSet(); + auto is_snapshot_name_loc_set = isSnapshotLocSet(); std::string filepath; - S32 i = 1; - S32 err = 0; - std::string extension("." + image->getExtension()); + auto i = 1; + auto err = 0; + auto extension("." + image->getExtension()); + auto now = LLDate::now(); do { filepath = sSnapshotDir; filepath += gDirUtilp->getDirDelimiter(); filepath += sSnapshotBaseName; - - if (is_snapshot_name_loc_set) - { - filepath += llformat("_%.3d",i); - } - + filepath += now.toLocalDateString("_%Y-%m-%d_%H%M%S"); + filepath += llformat("%.2d", i); filepath += extension; llstat stat_info; - err = LLFile::stat( filepath, &stat_info ); + err = LLFile::stat(filepath, &stat_info); i++; } while( -1 != err // Search until the file is not found (i.e., stat() gives an error). |