mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:44:01 +02:00
Add getCreatedAgo()
This commit is contained in:
parent
bf48ecda6d
commit
00c70278c8
2 changed files with 5 additions and 2 deletions
|
@ -489,10 +489,9 @@ void EntityServer::startDynamicDomainVerification() {
|
|||
|
||||
if (networkReply->error() == QNetworkReply::NoError) {
|
||||
if (jsonObject["domain_id"].toString() != thisDomainID) {
|
||||
if (QDateTime::currentMSecsSinceEpoch() - entity->getProperties().getCreated()/1000 > _MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS) {
|
||||
if (entity->getCreatedAgo() > (_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS/1000)) {
|
||||
qCDebug(entities) << "Entity's cert's domain ID" << jsonObject["domain_id"].toString()
|
||||
<< "doesn't match the current Domain ID" << thisDomainID << "; deleting entity" << i.value();
|
||||
qCDebug(entities) << "Time since rez (seconds):" << (QDateTime::currentMSecsSinceEpoch() - entity->getProperties().getCreated() / 1000) / 1000;
|
||||
tree->deleteEntity(i.value(), true);
|
||||
} else {
|
||||
qCDebug(entities) << "Entity failed dynamic domain verification, but was created too recently to necessitate deletion:" << i.value();
|
||||
|
|
|
@ -222,6 +222,10 @@ public:
|
|||
|
||||
quint64 getCreated() const; /// get the created-time in useconds for the entity
|
||||
void setCreated(quint64 value); /// set the created-time in useconds for the entity
|
||||
float getCreatedAgo() const /// Elapsed seconds since this entity was created
|
||||
{
|
||||
return (float)(usecTimestampNow() - getCreated()) / (float)USECS_PER_SECOND;
|
||||
}
|
||||
|
||||
/// is this entity immortal, in that it has no lifetime set, and will exist until manually deleted
|
||||
bool isImmortal() const { return getLifetime() == ENTITY_ITEM_IMMORTAL_LIFETIME; }
|
||||
|
|
Loading…
Reference in a new issue