Show cache creation time (as UTC) in about and regsysinfo.

Nicky 2014-06-08 23:33:14 +02:00
parent b24e5056e0
commit fef5cfdfd6
4 changed files with 56 additions and 1 deletions

View File

@ -267,6 +267,22 @@ LLVFS::LLVFS(const std::string& index_filename, const std::string& data_filename
// Since we're creating this data file, assume any index file is bogus
// remove the index, since this vfs is now blank
LLFile::remove(mIndexFilename);
// <FS:ND> When recreating the cache, also add a marker when we did this (for about/sysinfo)
LLFile::remove(mIndexFilename + ".date" );
LLFILE *fp = LLFile::fopen( mIndexFilename + ".date", "w" );
if( fp )
{
std::stringstream strm;
time_t tmin;
time( &tmin );
tm *pTm = gmtime( &tmin );
strm << std::asctime( pTm ) << " " << std::endl;
fwrite( strm.str().c_str(), strm.str().size(), 1, fp );
LLFile::close( fp );
}
// </FS:ND>
}
else
{
@ -2203,3 +2219,22 @@ void LLVFS::unlockAndClose(LLFILE *fp)
fclose(fp);
}
}
// <FS:ND> Query when this cache was created, Returns the time and date in UTC, or unknown,
std::string LLVFS::getCreationDataUTC() const
{
llifstream date_file;
date_file.open(mIndexFilename + ".date");
if (date_file.is_open())
{
std::string date;
std::getline(date_file, date);
date_file.close();
if( date.size() )
return date;
}
return "unknown";
}
// </FS:ND>

View File

@ -175,6 +175,11 @@ protected:
S32 mLockCounts[VFSLOCK_COUNT];
BOOL mRemoveAfterCrash;
// <FS:ND> Query when this cache was created, Returns the time and date in UTC, or unknown,
public:
std::string getCreationDataUTC() const;
// </FS:ND>
};
extern LLVFS *gVFS;

View File

@ -53,6 +53,7 @@
#include "llviewermedia.h"
#include "llviewernetwork.h"
#include "llxorcipher.h"
#include "llvfs.h"
const std::string LEGACY_CLIENT_LIST_URL = "http://phoenixviewer.com/app/client_tags/client_list_v2.xml";
const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");
@ -979,7 +980,8 @@ LLSD FSData::getSystemInfo()
sysinfo2 += llformat("Bandwidth: %d kbit/s\n", info["BANDWIDTH"].asInteger());
sysinfo2 += llformat("LOD Factor: %.3f\n", info["LOD"].asReal());
sysinfo2 += llformat("Render quality: %s\n", info["RENDERQUALITY_FSDATA_ENGLISH"].asString().c_str()); // <FS:PP> FIRE-4785: Current render quality setting in sysinfo / about floater
sysinfo2 += llformat("Texture memory: %d MB (%.2f)", info["TEXTUREMEMORY"].asInteger(), info["TEXTUREMEMORYMULTIPLIER"].asReal());
sysinfo2 += llformat("Texture memory: %d MB (%.2f)\n", info["TEXTUREMEMORY"].asInteger(), info["TEXTUREMEMORYMULTIPLIER"].asReal());
sysinfo2 += "VFS (cache) creation time (UTC) " + info["VFS_DATE"].asString();
LLSD sysinfos;
sysinfos["Part1"] = sysinfo1;

View File

@ -3986,6 +3986,13 @@ LLSD LLAppViewer::getViewerInfo() const
info["TEXTUREMEMORYMULTIPLIER"] = gSavedSettings.getF32("RenderTextureMemoryMultiple");
// </FS:Ansariel>
// <FS:ND> Add creation time of VFS (cache)
if( gVFS )
info["VFS_DATE"] = gVFS->getCreationDataUTC();
else
info["VFS_DATE"] = "unknown";
// </FS:ND>
return info;
}
@ -4059,6 +4066,12 @@ std::string LLAppViewer::getViewerInfoString() const
{
support << '\n' << LLTrans::getString("AboutTraffic", args);
}
// <FS:ND> Add when the cache was created,
if( info.has("VFS_DATE") )
support << "\nVFS (cache) creation time (UTC) " << info["VFS_DATE"];
// </FS:ND>
return support.str();
}