本文整理汇总了C++中poco::DateTime::assign方法的典型用法代码示例。如果您正苦于以下问题:C++ DateTime::assign方法的具体用法?C++ DateTime::assign怎么用?C++ DateTime::assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poco::DateTime
的用法示例。
在下文中一共展示了DateTime::assign方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testInsertRequest
void MongoDBTest::testInsertRequest()
{
if (!_connected)
{
std::cout << "Not connected, test skipped." << std::endl;
return;
}
Poco::MongoDB::Document::Ptr player = new Poco::MongoDB::Document();
player->add("lastname", std::string("Braem"));
player->add("firstname", std::string("Franky"));
Poco::DateTime birthdate;
birthdate.assign(1969, 3, 9);
player->add("birthdate", birthdate.timestamp());
player->add("start", 1993);
player->add("active", false);
Poco::DateTime now;
std::cout << now.day() << " " << now.hour() << ":" << now.minute() << ":" << now.second() << std::endl;
player->add("lastupdated", now.timestamp());
player->add("unknown", NullValue());
Poco::MongoDB::InsertRequest request("team.players");
request.documents().push_back(player);
_mongo.sendRequest(request);
}
示例2: PopulateIDList
void InactiveIdentityRequester::PopulateIDList()
{
Poco::DateTime weekago;
int id;
int count=0;
SQLite3DB::Transaction trans(m_db);
weekago-=Poco::Timespan(7,0,0,0,0);
weekago.assign(weekago.year(),weekago.month(),weekago.day(),0,0,0);
// only selects, deferred OK
trans.Begin();
// select identities we want to query (haven't seen yet today) - sort by their trust level (descending) with secondary sort on how long ago we saw them (ascending)
SQLite3DB::Statement st=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublicKey IS NOT NULL AND PublicKey <> '' AND LastSeen IS NOT NULL AND LastSeen<? AND tblIdentity.FailureCount<=(SELECT OptionValue FROM tblOption WHERE Option='MaxFailureCount') AND (PurgeDate IS NULL OR PurgeDate>datetime('now')) ORDER BY RANDOM();");
st.Bind(0, Poco::DateTimeFormatter::format(weekago,"%Y-%m-%d %H:%M:%S"));
trans.Step(st);
m_ids.clear();
while(st.RowReturned())
{
st.ResultInt(0,id);
m_ids[std::pair<long,long>(count,id)].m_requested=false;
trans.Step(st);
count+=1;
}
trans.Finalize(st);
trans.Commit();
}
示例3: CheckForNeededInsert
void TrustListInserter::CheckForNeededInsert()
{
Poco::DateTime date;
int currentday=date.day();
date-=Poco::Timespan(0,6,0,0,0);
// insert trust lists every 6 hours - if 6 hours ago was different day then set to midnight of current day to insert list today ASAP
if(currentday!=date.day())
{
date.assign(date.year(),date.month(),currentday,0,0,0);
}
SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID, PrivateKey FROM tblLocalIdentity WHERE tblLocalIdentity.Active='true' AND PrivateKey IS NOT NULL AND PrivateKey <> '' AND PublishTrustList='true' AND InsertingTrustList='false' AND (LastInsertedTrustList<=? OR LastInsertedTrustList IS NULL);");
st.Bind(0,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S"));
st.Step();
if(st.RowReturned())
{
int lid=0;
std::string pkey("");
st.ResultInt(0,lid);
st.ResultText(1,pkey);
StartInsert(lid,pkey);
}
}
示例4: dateTimeSync
void Utility::dateTimeSync(Poco::DateTime& dt, const SQL_TIMESTAMP_STRUCT& ts)
{
double msec = ts.fraction/1000000;
double usec = 1000 * (msec - std::floor(msec));
dt.assign(ts.year,
ts.month,
ts.day,
ts.hour,
ts.minute,
ts.second,
(int) std::floor(msec),
(int) std::floor(usec));
}
示例5: testInsertRequest
void MongoDBTest::testInsertRequest()
{
Poco::MongoDB::Document::Ptr player = new Poco::MongoDB::Document();
player->add("lastname", std::string("Braem"));
player->add("firstname", std::string("Franky"));
Poco::DateTime birthdate;
birthdate.assign(1969, 3, 9);
player->add("birthdate", birthdate.timestamp());
player->add("start", 1993);
player->add("active", false);
Poco::DateTime now;
player->add("lastupdated", now.timestamp());
player->add("unknown", NullValue());
Poco::MongoDB::InsertRequest request("team.players");
request.documents().push_back(player);
_mongo->sendRequest(request);
}