bool CSourceSaver::IsExpired(CString expirationdate) { int year = _tstoi(expirationdate.Mid(0, 2)) + 2000; int month = _tstoi(expirationdate.Mid(2, 2)); int day = _tstoi(expirationdate.Mid(4, 2)); //MORPH - Added by SiRoB, SLS keep only for rare files, reduce Saved Source and life time int hour = _tstoi(expirationdate.Mid(6, 2)); int minute = _tstoi(expirationdate.Mid(8, 2)); //MORPH - Changed by SiRoB, SLS keep only for rare files, reduce Saved Source and life time //CTime expiration(year, month, day, 0, 0, 0); CTime expiration(year, month, day, hour, minute, 0); return (expiration < CTime::GetCurrentTime()); }
void Chrome_Extractor::extract_cookies() { { SQLITE_OPEN(file) QSqlQuery query(db); QString insert_query; QSqlField name("name", QVariant::String); QSqlField value("value", QVariant::String); QSqlField host("host", QVariant::String); QSqlField path("path", QVariant::String); QSqlField expiration("expiration", QVariant::String); QSqlField secured("secured", QVariant::String); QSqlField http("http", QVariant::String); QSqlField last_accessed("last_accessed", QVariant::String); query.exec("SELECT name, value, host_key, path, has_expires, secure, httponly, last_access_utc FROM cookies ORDER BY last_access_utc;"); while (query.next()) { name.setValue(query.value(0)); value.setValue(query.value(1)); host.setValue(query.value(2)); path.setValue(query.value(3)); expiration.setValue(query.value(4)); secured.setValue(query.value(5)); http.setValue(query.value(6)); last_accessed.setValue(query.value(7)); insert_query = "INSERT INTO cookie (name, value, host, path, expiration, secured, http, last_accessed) VALUES ("; insert_query += "'" % db.driver()->formatValue(name) % "',"; insert_query += "'" % db.driver()->formatValue(value) % "',"; insert_query += "'" % db.driver()->formatValue(host) % "',"; insert_query += "'" % db.driver()->formatValue(path) % "',"; insert_query += "'" % db.driver()->formatValue(expiration) % "',"; insert_query += "'" % db.driver()->formatValue(secured) % "',"; insert_query += "'" % db.driver()->formatValue(http) % "',"; insert_query += "'" % db.driver()->formatValue(last_accessed); insert_query += "');"; send_zmq(insert_query); } query.clear(); insert_query.clear(); } SQLITE_CLOSE(file) }
TER doApply () override { assert (mTxnAccount); // A ticket counts against the reserve of the issuing account, but we check // the starting balance because we want to allow dipping into the reserve to // pay fees. auto const accountReserve (mEngine->getLedger ()->getReserve ( mTxnAccount->getFieldU32 (sfOwnerCount) + 1)); if (mPriorBalance.getNValue () < accountReserve) return tecINSUFFICIENT_RESERVE; std::uint32_t expiration (0); if (mTxn.isFieldPresent (sfExpiration)) { expiration = mTxn.getFieldU32 (sfExpiration); if (!expiration) { m_journal.warning << "Malformed ticket requestion: bad expiration"; return temBAD_EXPIRATION; } if (mEngine->getLedger ()->getParentCloseTimeNC () >= expiration) return tesSUCCESS; } SLE::pointer sleTicket = mEngine->entryCreate (ltTICKET, Ledger::getTicketIndex (mTxnAccountID, mTxn.getSequence ())); sleTicket->setFieldAccount (sfAccount, mTxnAccountID); sleTicket->setFieldU32 (sfSequence, mTxn.getSequence ()); if (expiration != 0) sleTicket->setFieldU32 (sfExpiration, expiration); if (mTxn.isFieldPresent (sfTarget)) { Account const target_account (mTxn.getFieldAccount160 (sfTarget)); SLE::pointer sleTarget = mEngine->entryCache (ltACCOUNT_ROOT, Ledger::getAccountRootIndex (target_account)); // Destination account does not exist. if (!sleTarget) return tecNO_TARGET; // The issuing account is the default account to which the ticket // applies so don't bother saving it if that's what's specified. if (target_account != mTxnAccountID) sleTicket->setFieldAccount (sfTarget, target_account); } std::uint64_t hint; auto describer = [&](SLE::pointer p, bool b) { Ledger::ownerDirDescriber(p, b, mTxnAccountID); }; TER result = mEngine->view ().dirAdd ( hint, Ledger::getOwnerDirIndex (mTxnAccountID), sleTicket->getIndex (), describer); m_journal.trace << "Creating ticket " << to_string (sleTicket->getIndex ()) << ": " << transHuman (result); if (result != tesSUCCESS) return result; sleTicket->setFieldU64(sfOwnerNode, hint); // If we succeeded, the new entry counts agains the creator's reserve. mEngine->view ().incrementOwnerCount (mTxnAccount); return result; }
//设置新的超时时间 void TimerfdHandler::resetTimerfd(uint64_t next_expire_us, int interval_us/* = 0*/) { Timestamp expiration(Timestamp::now().microSeconds() + next_expire_us); resetTimerfd(expiration, interval_us); }
double bsmodel::time_to_expiration() const { double left = ((expiration() - _quote_time) / (365.25*86400.0)); return(left); }
ter doapply () override { assert (mtxnaccount); // a ticket counts against the reserve of the issuing account, but we check // the starting balance because we want to allow dipping into the reserve to // pay fees. auto const accountreserve (mengine->getledger ()->getreserve ( mtxnaccount->getfieldu32 (sfownercount) + 1)); if (mpriorbalance.getnvalue () < accountreserve) return tecinsufficient_reserve; std::uint32_t expiration (0); if (mtxn.isfieldpresent (sfexpiration)) { expiration = mtxn.getfieldu32 (sfexpiration); if (!expiration) { m_journal.warning << "malformed ticket requestion: bad expiration"; return tembad_expiration; } if (mengine->getledger ()->getparentclosetimenc () >= expiration) return tessuccess; } sle::pointer sleticket = mengine->entrycreate (ltticket, getticketindex (mtxnaccountid, mtxn.getsequence ())); sleticket->setfieldaccount (sfaccount, mtxnaccountid); sleticket->setfieldu32 (sfsequence, mtxn.getsequence ()); if (expiration != 0) sleticket->setfieldu32 (sfexpiration, expiration); if (mtxn.isfieldpresent (sftarget)) { account const target_account (mtxn.getfieldaccount160 (sftarget)); sle::pointer sletarget = mengine->entrycache (ltaccount_root, getaccountrootindex (target_account)); // destination account does not exist. if (!sletarget) return tecno_target; // the issuing account is the default account to which the ticket // applies so don't bother saving it if that's what's specified. if (target_account != mtxnaccountid) sleticket->setfieldaccount (sftarget, target_account); } std::uint64_t hint; auto describer = [&](sle::pointer p, bool b) { ledger::ownerdirdescriber(p, b, mtxnaccountid); }; ter result = mengine->view ().diradd ( hint, getownerdirindex (mtxnaccountid), sleticket->getindex (), describer); m_journal.trace << "creating ticket " << to_string (sleticket->getindex ()) << ": " << transhuman (result); if (result != tessuccess) return result; sleticket->setfieldu64(sfownernode, hint); // if we succeeded, the new entry counts agains the creator's reserve. mengine->view ().incrementownercount (mtxnaccount); return result; }