summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloater360capture.cpp11
-rw-r--r--indra/newview/llviewerwindow.cpp20
2 files changed, 11 insertions, 20 deletions
diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp
index 49999495c0..25970f8a08 100644
--- a/indra/newview/llfloater360capture.cpp
+++ b/indra/newview/llfloater360capture.cpp
@@ -33,6 +33,7 @@
#include "llagentui.h"
#include "llbase64.h"
#include "llcallbacklist.h"
+#include "lldate.h"
#include "llenvironment.h"
#include "llimagejpeg.h"
#include "llmediactrl.h"
@@ -879,15 +880,7 @@ const std::string LLFloater360Capture::generate_proposed_filename()
filename << "_";
// add in the current HH-MM-SS (with leading 0's) so users can easily save many shots in same folder
- std::time_t cur_epoch = std::time(nullptr);
- std::tm* tm_time = std::localtime(&cur_epoch);
- filename << std::setfill('0') << std::setw(4) << (tm_time->tm_year + 1900);
- filename << std::setfill('0') << std::setw(2) << (tm_time->tm_mon + 1);
- filename << std::setfill('0') << std::setw(2) << tm_time->tm_mday;
- filename << "_";
- filename << std::setfill('0') << std::setw(2) << tm_time->tm_hour;
- filename << std::setfill('0') << std::setw(2) << tm_time->tm_min;
- filename << std::setfill('0') << std::setw(2) << tm_time->tm_sec;
+ filename << LLDate::now().toLocalDateString("%Y%m%d_%H%M%S");
// the unusual way we save the output image (originates in the
// embedded browser and not the C++ code) means that the system
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).