Do not accept "lastSeen" timestamps older or equal to the UNIX epoch
The UNIX epoch seems to be the "null-value" provided by Syncthing's API when there's no "lastSeen" timestamp, e.g. when it is the own device.
This commit is contained in:
parent
bdf00a9889
commit
1cfd067abd
|
@ -1202,7 +1202,8 @@ void SyncthingConnection::readDeviceStatistics()
|
|||
const QJsonObject devObj(replyObj.value(devInfo.id).toObject());
|
||||
if (!devObj.isEmpty()) {
|
||||
try {
|
||||
devInfo.lastSeen = DateTime::fromIsoStringLocal(devObj.value(QLatin1String("lastSeen")).toString().toUtf8().data());
|
||||
const auto [localTime, utcOffset] = DateTime::fromIsoString(devObj.value(QLatin1String("lastSeen")).toString().toUtf8().data());
|
||||
devInfo.lastSeen = (localTime - utcOffset) > DateTime::unixEpochStart() ? localTime : DateTime();
|
||||
emit devStatusChanged(devInfo, index);
|
||||
} catch (const ConversionException &) {
|
||||
devInfo.lastSeen = DateTime();
|
||||
|
|
Loading…
Reference in New Issue