Changed: difference time to absolute time.

This commit is contained in:
Konrad 2017-04-24 16:00:23 +02:00
parent f571b05693
commit 8da5e15180
2 changed files with 3 additions and 6 deletions

View File

@ -418,8 +418,7 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
}
resp.mDataStream << makeKeyValue("pgp_name", pgp_name);
time_t now = time(NULL);
resp.mDataStream << makeKeyValue("last_usage", difftime(now, data.mLastUsageTS));
resp.mDataStream << makeKeyValue("last_usage", (uint32_t)data.mLastUsageTS);
bool isAnonymous = false;
if(!data.mPgpKnown)
@ -475,7 +474,7 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
for(std::map<RsIdentityUsage,time_t>::const_iterator it(details.mUseCases.begin()); it != details.mUseCases.end(); ++it)
{
usagesStream.getStreamToMember()
<< makeKeyValue("usage_time", difftime(now, data.mLastUsageTS))
<< makeKeyValue("usage_time", (uint32_t)data.mLastUsageTS)
<< makeKeyValue("usage_service", (int)(it->first.mServiceId))
<< makeKeyValue("usage_case", (int)(it->first.mUsageCode));
}

View File

@ -7,7 +7,6 @@
#include <retroshare/rsiface.h>
#include <algorithm>
#include <time.h>
#include "Operators.h"
#include "ApiTypes.h"
@ -746,12 +745,11 @@ void PeersHandler::handleGetNodeOptions(Request& req, Response& resp)
return;
}
time_t now = time(NULL);
resp.mDataStream << makeKeyValue("peer_id", detail.id.toStdString());
resp.mDataStream << makeKeyValue("name", detail.name);
resp.mDataStream << makeKeyValue("location", detail.location);
resp.mDataStream << makeKeyValue("pgp_id", detail.gpg_id.toStdString());
resp.mDataStream << makeKeyValue("last_contact", difftime(now, detail.lastConnect));
resp.mDataStream << makeKeyValue("last_contact", detail.lastConnect);
std::string status_message = mRsMsgs->getCustomStateString(detail.id);
resp.mDataStream << makeKeyValueReference("status_message", status_message);