diff options
author | Bennett Goble <signal@lindenlab.com> | 2024-04-27 10:49:31 -0700 |
---|---|---|
committer | Bennett Goble <signal@lindenlab.com> | 2024-04-27 11:02:38 -0700 |
commit | 204b7ff6fb7544dd4210e125d275fd550f52f5c6 (patch) | |
tree | 0194b4d331ea4b6487f3a88eca768c36662ddff8 /indra/llcommon | |
parent | f886a438ed11468a90ecca9ba8046a6719f0402c (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/llcommon')
-rw-r--r-- | indra/llcommon/lldate.cpp | 9 | ||||
-rw-r--r-- | indra/llcommon/lldate.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index 2ddcf40895..39d5a3131e 100644 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -86,6 +86,15 @@ std::string LLDate::asRFC1123() const return toHTTPDateString (std::string ("%A, %d %b %Y %H:%M:%S GMT")); } +std::string LLDate::toLocalDateString (std::string fmt) const +{ + LL_PROFILE_ZONE_SCOPED; + + time_t locSeconds = (time_t) mSecondsSinceEpoch; + struct tm * lt = localtime (&locSeconds); + return toHTTPDateString(lt, fmt); +} + std::string LLDate::toHTTPDateString (std::string fmt) const { LL_PROFILE_ZONE_SCOPED; diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h index be2cd2d051..248de41da7 100644 --- a/indra/llcommon/lldate.h +++ b/indra/llcommon/lldate.h @@ -80,6 +80,7 @@ public: std::string asRFC1123() const; void toStream(std::ostream&) const; bool split(S32 *year, S32 *month = NULL, S32 *day = NULL, S32 *hour = NULL, S32 *min = NULL, S32 *sec = NULL) const; + std::string toLocalDateString (std::string fmt) const; std::string toHTTPDateString (std::string fmt) const; static std::string toHTTPDateString (tm * gmt, std::string fmt); /** |