当前位置: 首页>>代码示例>>C++>>正文


C++ Timestamp::epochTime方法代码示例

本文整理汇总了C++中poco::Timestamp::epochTime方法的典型用法代码示例。如果您正苦于以下问题:C++ Timestamp::epochTime方法的具体用法?C++ Timestamp::epochTime怎么用?C++ Timestamp::epochTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在poco::Timestamp的用法示例。


在下文中一共展示了Timestamp::epochTime方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: checkHelpConfigurationFile

void ofxTwitter::checkHelpConfigurationFile() {
    
    ofFile file(ofToDataPath("ofxTwitter_configuration.json"));
    bool configFileNeedsUpdate = false;
    if(file.exists()) {
        Poco::File &filepoco = file.getPocoFile();
        Poco::Timestamp tfile = filepoco.getLastModified();
        time_t timer;
        time(&timer);
        double seconds;
        seconds = difftime(timer,tfile.epochTime());
        if(seconds < 86400) {
            configFileNeedsUpdate = false;
        } else {
            configFileNeedsUpdate = true;
        }
    } else {
        configFileNeedsUpdate = true;
    }
    
    if(!configFileNeedsUpdate) {
        ofLogNotice("ofxTwitter::authorize") << "Config up to date.";
        parseConfigurationFile();
    } else {
        updateHelpConfiguration();
    }

}
开发者ID:brinoausrino,项目名称:ofxTwitter,代码行数:28,代码来源:ofxTwitter.cpp

示例2: flushSessionCache

void Context::flushSessionCache() 
{
	poco_assert (isForServerUse());

	Poco::Timestamp now;
	SSL_CTX_flush_sessions(_pSSLContext, static_cast<long>(now.epochTime()));
}
开发者ID:RobertAcksel,项目名称:poco,代码行数:7,代码来源:Context.cpp

示例3: deleteOld

void TrafficDataObject::deleteOld()
{
    Poco::Timestamp achshav;
    Poco::Timespan days = Poco::Timespan::DAYS * Poco::Util::Application::instance().config().getUInt("ion.trafficage");
    achshav -= days;
    std::time_t age = achshav.epochTime();
    _session << "DELETE FROM traffic WHERE time<?", use(age), now;
}
开发者ID:dtylman,项目名称:ion,代码行数:8,代码来源:TrafficDataObject.cpp

示例4: getLastModified

std::time_t UIShader::getLastModified( ofFile& _file ){
	if( _file.exists() ){
		Poco::File& pocoFile		= _file.getPocoFile();
		Poco::Timestamp timestamp	= pocoFile.getLastModified();
		std::time_t fileChangedTime = timestamp.epochTime();
		
		return fileChangedTime;
	} else {
		return 0;
	}
}
开发者ID:patriciogonzalezvivo,项目名称:ofxPro,代码行数:11,代码来源:UIShader.cpp

示例5: checkAuthStatus

void TrafficDataObject::checkAuthStatus()
{
    Poco::Timestamp achshav;
    Poco::Timespan days = Poco::Timespan::MINUTES * Poco::Util::Application::instance().config().getUInt("ion.traffic-interval");
    achshav -= days;
    std::time_t age = achshav.epochTime();
    unsigned count = 0;
    _session << "SELECT sum(count) AS count FROM traffic WHERE time>? AND "
            "traffic.domain NOT IN (SELECT value FROM authorized_traffic WHERE  type='domain') AND "
            "traffic.ip NOT IN (SELECT value FROM authorized_traffic WHERE  type='ip') AND "
            "traffic.port NOT IN (SELECT value FROM authorized_traffic WHERE  type='port') AND "
            "traffic.process NOT IN (SELECT value FROM authorized_traffic WHERE  type='process')", use(age), into(count), now;
    if (count > 0) {
        _logger.notice("Non authorized traffic count %u", count);
        EventNotification::notifyTraffic(count);
    }
}
开发者ID:dtylman,项目名称:ion,代码行数:17,代码来源:TrafficDataObject.cpp

示例6: refresh

void ICalendarWatcher::refresh()
{
    Poco::Timestamp now; // the current time

    if (_calendar)
    {
        ICalendar::EventInstances oldInstances = _watches;
        ICalendar::EventInstances newInstances = _calendar->getEventInstances(now);

        // sort uids lexigraphically
        std::sort(oldInstances.begin(), oldInstances.end(), compareUID);
        std::sort(newInstances.begin(), newInstances.end(), compareUID);

        // unmatchedOldInstances are those events instances that are NOT
        // seen in the current instanaces.  if an instance is NOT seen,
        // that means that an instance has ended (we can check for that)
        // OR the event was "modified" -- that is -- the equality
        // relationship didn't hold and we need to check for UID equality
        // in this case -- OR the event was deleted altogether from the
        // calendar.

        ICalendar::EventInstances unmatchedOldInstances;

        // unmatchedNewInstances are those instances that did not have an
        // equality match inside of the watchedInstances vector.  Events in
        // this array can fall into three categories: 1) a modified event
        // -- == opererator failed because of a different modified date,
        // 2) an event that has just started 3) an in-progress event that
        // was added after its start time.

        ICalendar::EventInstances unmatchedNewInstances;

        // newWatches will eventually replace _watches when the refresh is done
        ICalendar::EventInstances newWatches;

        // std::set_difference - what is in first set, but not in the second one

        // TODO: combine all three of these steps into a single loop

        // find any instances that are in the current watch list that are no longer there
        std::set_difference(oldInstances.begin(),
                            oldInstances.end(),
                            newInstances.begin(),
                            newInstances.end(),
                            std::inserter(unmatchedOldInstances,
                                          unmatchedOldInstances.end()),
                            compareUID);

        // find any new instances that are not matched in the current watchlist
        std::set_difference(newInstances.begin(),
                            newInstances.end(),
                            oldInstances.begin(),
                            oldInstances.end(),
                            std::inserter(unmatchedNewInstances,
                                          unmatchedNewInstances.end()),
                            compareUID);

        // find all instances that are still are the same in both sets.
        // these instances must be checked for modification times.
        std::set_intersection(newInstances.begin(),
                              newInstances.end(),
                              oldInstances.begin(),
                              oldInstances.end(),
                              std::inserter(newWatches,
                                            newWatches.end()),
                              compareUID);

        // process the unmatched old instances
        ICalendar::EventInstances::iterator unmatchedOldInstancesIter = unmatchedOldInstances.begin();

        while (unmatchedOldInstancesIter != unmatchedOldInstances.end())
        {
            ICalendarEventInstance& instance = *unmatchedOldInstancesIter;
            Poco::Timestamp startTime = instance.getInterval().getStart();
            Poco::Timestamp endTime = instance.getInterval().getEnd();

            if (!instance.isValidEventInstance() || endTime.epochTime() < _lastUpdate.epochTime())
            {
                ofNotifyEvent(events.onEventRemoved, instance, this);
            }
            else
            {
                ofNotifyEvent(events.onEventEnded, instance, this);
            }

            ++unmatchedOldInstancesIter;
        }

        // process the old matches and check them for updates
        // process the unmatched old instances
        ICalendar::EventInstances::iterator newWatchesIter = newWatches.begin();

        while (newWatchesIter != newWatches.end())
        {
            const ICalendarEvent& evt = (*newWatchesIter).getEvent();

            std::string uid = evt.getUID();
            Poco::Timestamp lastModified = evt.getLastModified();

            std::map<std::string, Poco::Timestamp>::iterator lastUpdatedIter = _watchesLastUpdated.find(uid);
//.........这里部分代码省略.........
开发者ID:notandrewkaye,项目名称:ofxICalendar,代码行数:101,代码来源:ICalendarWatcher.cpp

示例7: threadedFunction


//.........这里部分代码省略.........
                            if (element.isMember("id")) {
                                string packageId = element["id"].asString();
                                if (packageId == _packageId || packageId == "8102") { //hack for rental
                                    // Found matching package, check that purchase is valid.
                                    if (element.isMember("purchase_type")) {
                                        string purchaseType = element["purchase_type"].asString();
                                        if (purchaseType == "purchase") {
                                            state = PURCHASE;
                                            completeArgs.success = true;
                                            completeArgs.result = "purchase";
                                            break;
                                        }
                                        else if (purchaseType == "rental") {
                                            if (element.isMember("expires_at")) {
                                                if (element["expires_at"].isNull()) {
                                                    // No expiry, assume we're good.
                                                    state = RENTAL;
                                                    completeArgs.success = true;
                                                    completeArgs.result = "rental";
                                                    break;
                                                }
                                                else {
                                                    // Parse the expiry date.
                                                    Poco::DateTime dt;
                                                    int tzd;
                                                    if (Poco::DateTimeParser::tryParse(element["expires_at"].asString(), dt, tzd)) {
                                                        Poco::LocalDateTime ldt(tzd, dt);
                                                        Poco::Timestamp expiryTime = ldt.timestamp();
                                                        Poco::Timestamp nowTime;
                                                        
                                                        // Make sure the rental is valid.
                                                        if (nowTime < expiryTime) {
                                                            // Expires in the future, we're good.
                                                            _packageExpiry = expiryTime.epochTime();
                                                            
                                                            state = RENTAL;
                                                            completeArgs.success = true;
                                                            completeArgs.result = "rental";
                                                            break;
                                                        }
                                                        else {
                                                            // Expired, no good.
                                                            state = EXPIRED;
                                                            completeArgs.success = true;
                                                            completeArgs.result = "expired";
                                                            continue; //check other packages
                                                        }
                                                    }
                                                    else {
                                                        // Could not parse expiry, assume no good.
                                                        state = EXPIRED;
                                                        completeArgs.success = true;
                                                        completeArgs.result = "expired";
                                                        continue; //check the other packages
                                                    }
                                                }
                                            }
                                            else {
                                                // No expiry, assume we're good.
                                                state = RENTAL;
                                                completeArgs.success = true;
                                                completeArgs.result = "rental";
                                                break;
                                            }
                                        }
                                        else {
开发者ID:CLOUDS-Interactive-Documentary,项目名称:CLOUDS,代码行数:67,代码来源:CloudsVHXAuth.cpp


注:本文中的poco::Timestamp::epochTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。