mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add simple detection of timestamp resolution
Set access time equal to modification time
This commit is contained in:
parent
d8c62f8eba
commit
b3896f2600
@ -225,18 +225,29 @@ void CsvImportWidget::writeDatabase()
|
|||||||
if (m_parserModel->data(m_parserModel->index(r, 8)).isValid()) {
|
if (m_parserModel->data(m_parserModel->index(r, 8)).isValid()) {
|
||||||
auto datetime = m_parserModel->data(m_parserModel->index(r, 8)).toString();
|
auto datetime = m_parserModel->data(m_parserModel->index(r, 8)).toString();
|
||||||
if (datetime.contains(QRegularExpression("^\\d+$"))) {
|
if (datetime.contains(QRegularExpression("^\\d+$"))) {
|
||||||
timeInfo.setLastModificationTime(Clock::datetimeUtc(datetime.toLongLong() * 1000));
|
auto t = datetime.toLongLong();
|
||||||
|
if (t <= INT32_MAX) {
|
||||||
|
t *= 1000;
|
||||||
|
}
|
||||||
|
auto lastModified = Clock::datetimeUtc(t);
|
||||||
|
timeInfo.setLastModificationTime(lastModified);
|
||||||
|
timeInfo.setLastAccessTime(lastModified);
|
||||||
} else {
|
} else {
|
||||||
auto lastModified = QDateTime::fromString(datetime, Qt::ISODate);
|
auto lastModified = QDateTime::fromString(datetime, Qt::ISODate);
|
||||||
if (lastModified.isValid()) {
|
if (lastModified.isValid()) {
|
||||||
timeInfo.setLastModificationTime(lastModified);
|
timeInfo.setLastModificationTime(lastModified);
|
||||||
|
timeInfo.setLastAccessTime(lastModified);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_parserModel->data(m_parserModel->index(r, 9)).isValid()) {
|
if (m_parserModel->data(m_parserModel->index(r, 9)).isValid()) {
|
||||||
auto datetime = m_parserModel->data(m_parserModel->index(r, 9)).toString();
|
auto datetime = m_parserModel->data(m_parserModel->index(r, 9)).toString();
|
||||||
if (datetime.contains(QRegularExpression("^\\d+$"))) {
|
if (datetime.contains(QRegularExpression("^\\d+$"))) {
|
||||||
timeInfo.setCreationTime(Clock::datetimeUtc(datetime.toLongLong() * 1000));
|
auto t = datetime.toLongLong();
|
||||||
|
if (t <= INT32_MAX) {
|
||||||
|
t *= 1000;
|
||||||
|
}
|
||||||
|
timeInfo.setCreationTime(Clock::datetimeUtc(t));
|
||||||
} else {
|
} else {
|
||||||
auto created = QDateTime::fromString(datetime, Qt::ISODate);
|
auto created = QDateTime::fromString(datetime, Qt::ISODate);
|
||||||
if (created.isValid()) {
|
if (created.isValid()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user