Move currentDateTime suffix to isoDateTime in StringUtil.h
This commit is contained in:
parent
dd76320156
commit
ea631d4539
|
@ -479,7 +479,7 @@ void LogView::saveToFileSlot(QString fileName)
|
|||
void LogView::saveSlot()
|
||||
{
|
||||
QString fileName;
|
||||
fileName = QString("log-%1.txt").arg(QDateTime::currentDateTime().toString().replace(QChar(':'), QChar('-')));
|
||||
fileName = QString("log-%1.txt").arg(isoDateTime());
|
||||
saveToFileSlot(fileName);
|
||||
}
|
||||
|
||||
|
|
|
@ -374,15 +374,7 @@ QString getDbPath(const QString & filename, bool addDateTimeSuffix)
|
|||
{
|
||||
extensionIdx = path.length();
|
||||
}
|
||||
auto now = QDateTime::currentDateTime();
|
||||
auto suffix = QString().sprintf("-%04d%02d%02d-%02d%02d%02d",
|
||||
now.date().year(),
|
||||
now.date().month(),
|
||||
now.date().day(),
|
||||
now.time().hour(),
|
||||
now.time().minute(),
|
||||
now.time().second()
|
||||
);
|
||||
auto suffix = "-" + isoDateTime();
|
||||
path.insert(extensionIdx, suffix);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,6 +219,19 @@ QString GetDataTypeString(const void* buffer, duint size, ENCODETYPE type)
|
|||
}
|
||||
}
|
||||
|
||||
QString isoDateTime()
|
||||
{
|
||||
auto now = QDateTime::currentDateTime();
|
||||
return QString().sprintf("%04d%02d%02d-%02d%02d%02d",
|
||||
now.date().year(),
|
||||
now.date().month(),
|
||||
now.date().day(),
|
||||
now.time().hour(),
|
||||
now.time().minute(),
|
||||
now.time().second()
|
||||
);
|
||||
}
|
||||
|
||||
QString ToDateString(const QDate & date)
|
||||
{
|
||||
static const char* months[] =
|
||||
|
|
|
@ -104,6 +104,9 @@ inline QString ToDoubleString(const void* buffer, int precision = std::numeric_l
|
|||
|
||||
QString ToLongDoubleString(const void* buffer);
|
||||
|
||||
// yyyyMMdd-HHmmss (useful for file suffix)
|
||||
QString isoDateTime();
|
||||
|
||||
QString ToDateString(const QDate & date);
|
||||
|
||||
QString fillValue(const char* value, int valsize = 2, bool bFpuRegistersLittleEndian = false);
|
||||
|
|
Loading…
Reference in New Issue