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


C++ poco::Timestamp类代码示例

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


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

示例1: evaluateBaseline

void TemplateMatchingTrainer::evaluateBaseline(const std::string &meanForAlign, const std::string &dataPath, const std::string &pcaDepthmapPath)
{
    FaceAligner aligner(Mesh::fromFile(meanForAlign), std::string());
    std::vector<std::string> fileNames = Face::LinAlg::Loader::listFiles(dataPath, "*.binz", Face::LinAlg::Loader::Filename);
    int n = fileNames.size();
    std::vector<int> ids = Face::Biometrics::BioDataProcessing::getIds(fileNames, "-");
    std::vector<Mesh> meshes(n);
    std::vector<double> times(n);

    #pragma omp parallel for
    for (int i = 0; i < n; i++)
    {
        //if (ids[i] >= 1002) break;
        //if (ids[i] < 5000) continue;

        Mesh m = Mesh::fromFile(dataPath + Poco::Path::separator() + fileNames[i]);
        SurfaceProcessor::mdenoising(m, 0.01, 10, 0.01);

        Poco::Timestamp before;
        aligner.icpAlign(m, 50, FaceAligner::TemplateMatching);
        times[i] = before.elapsed()/1000;
        meshes[i] = m;
    }

    std::cout << "mean align time (ms) :" << (std::accumulate(times.begin(), times.end(), 0.0)/n) << std::endl;
    evaluate(meshes, ids, pcaDepthmapPath);
}
开发者ID:zhuangfangwang,项目名称:face,代码行数:27,代码来源:templatematchingtrainer.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: lock

uint32_t MeetingFrameImpl::StartPublishVideo2(uint64_t ulToUserID,uint32_t ulChannelID,IVideoWin*videoWin)
{
	Mutex::ScopedLock lock(m_Mutex);
	if(ulChannelID <0)
		return 0;
	int count = GetVideoCaptureDeviceCount();
	if(count == 0)
		return 0;

	if(ulChannelID>GetVideoCaptureDeviceCount()-1)
		ulChannelID = 0;
	if(m_bHasStartVideo2 == true)
		return 0;
	m_bHasStartVideo2 = true;
	m_bVideoMonitor = true;
	uint64_t myGuid ;
	Poco::Timestamp t;
	uint32_t ulSSRC = unsigned int(t.epochMicroseconds()&0xFFFFFFFF);
	if(videoWin)
	{
		videoWin->SetUserID(0);
		videoWin->SetUserName(GetUserName(ulToUserID));
		m_myUserInfo.ulVideoSSRC = m_pIZYMediaStreamManager->StartVideoSender(ulSSRC,ulChannelID,
			videoWin, MeetingConnImpl::GetInstance()->GetRoomID());
		if(m_myUserInfo.ulVideoSSRC > 0)
		{
			return ulSSRC;
		}
	}
	else
	{
		return 0;
	}
}
开发者ID:ACEZLY,项目名称:openmeeting2,代码行数:34,代码来源:MeetingFrameImpl.cpp

示例4: StartupStore

void StartupStore(const TCHAR *Str, ...)
{
  TCHAR buf[(MAX_PATH*2)+1]; // 260 chars normally  FIX 100205
  va_list ap;

  va_start(ap, Str);
  _vsntprintf(buf, countof(buf), Str, ap);
  va_end(ap);

  LockStartupStore();

  FILE *startupStoreFile = NULL;
  static TCHAR szFileName[MAX_PATH];
  static Poco::Timestamp StartTime;
  static bool initialised = false;
  if (!initialised) {
	LocalPath(szFileName, TEXT(LKF_RUNLOG));
	initialised = true;
  } 

  startupStoreFile = _tfopen(szFileName, TEXT("ab+"));
  if (startupStoreFile != NULL) {
    char sbuf[(MAX_PATH*2)+1]; // FIX 100205
    
    int i = TCHAR2utf(buf, sbuf, sizeof(sbuf));
    
    if (i > 0) {
      if (sbuf[i - 1] == 0x0a && (i == 1 || (i > 1 && sbuf[i-2] != 0x0d)))
        sprintf(sbuf + i - 1, SNEWLINE);
      fprintf(startupStoreFile, "[%09u] %s", (unsigned int)StartTime.elapsed()/1000, sbuf);
    }
    fclose(startupStoreFile);
  }
  UnlockStartupStore();
}
开发者ID:SergioDaSilva82,项目名称:LK8000,代码行数:35,代码来源:MessageLog.cpp

示例5: LOGNS

int
FFmpegTagger::IORead(void *opaque, uint8_t *buf, int buf_size)
{
    URLContext* pUrlContext = (URLContext*)opaque;

    std::istream* pInputStream = (std::istream*)pUrlContext->priv_data;
    if (!pInputStream) {
        LOGNS(Omm::AvStream, avstream, error, "IORead failed, std::istream not set");
        return -1;
    }

    pInputStream->read((char*)buf, buf_size);
    Poco::Timestamp::TimeDiff time = _timestamp.elapsed();
    _timestamp.update();
    Poco::Timestamp::TimeDiff startTime = _startTimestamp.elapsed();
    int bytes = pInputStream->gcount();
    _totalBytes += bytes;
    if (!pInputStream->good()) {
        LOGNS(Omm::AvStream, avstream, error, "IORead failed to read from std::istream");
        return -1;
    }
    LOGNS(Omm::AvStream, avstream, trace, "IORead() bytes read: " + Poco::NumberFormatter::format(bytes) + " in " + Poco::NumberFormatter::format(time/1000.0, 3) + " msec (" +  Poco::NumberFormatter::format(bytes*1000/time) + " kB/s), total : " +\
    Poco::NumberFormatter::format(_totalBytes/1000) + "kB in " + Poco::NumberFormatter::format(startTime/(Poco::Timestamp::TimeDiff)1000000) + " sec (" + Poco::NumberFormatter::format((Poco::Timestamp::TimeDiff)(_totalBytes*1000)/startTime) + "kB/s)");
    return bytes;
}
开发者ID:BackupTheBerlios,项目名称:openmm,代码行数:25,代码来源:AvStreamFFmpeg.cpp

示例6: testSleep

void ThreadTest::testSleep()
{
	Poco::Timestamp start;
	Thread::sleep(200);
	Poco::Timespan elapsed = start.elapsed();
	assert (elapsed.totalMilliseconds() >= 190 && elapsed.totalMilliseconds() < 250);
}
开发者ID:cshnick,项目名称:CommunicationModel,代码行数:7,代码来源:ThreadTest.cpp

示例7: 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

示例8: testPerformance

void TileCacheTests::testPerformance()
{
    std::string documentPath, documentURL;
    getDocumentPathAndURL("hello.odt", documentPath, documentURL);
    Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);

    auto socket = *loadDocAndGetSocket(_uri, documentURL, "tile-performance ");
    getResponseMessage(socket, "invalidatetiles:");

    Poco::Timestamp timestamp;
    for (auto x = 0; x < 5; ++x)
    {
        sendTextFrame(socket, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840");
        for (auto i = 0; i < 8; ++i)
        {
            auto tile = getResponseMessage(socket, "tile:", "tile-performance ");
            CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile.empty());
        }
    }

    std::cerr << "Tile rendering roundtrip for 5 x 8 tiles combined: " << timestamp.elapsed() / 1000.
              << " ms. Per-tilecombine: " << timestamp.elapsed() / (1000. * 5)
              << " ms. Per-tile: " << timestamp.elapsed() / (1000. * 5 * 8) << "ms."
              << std::endl;

    socket.shutdown();
}
开发者ID:brendankehoe,项目名称:libre,代码行数:27,代码来源:TileCacheTests.cpp

示例9: 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

示例10: run

void Timer::run()
{
	Poco::Timestamp now;
	long interval(0);
	do
	{
		long sleep(0);
		do
		{
			now.update();
			sleep = static_cast<long>((_nextInvocation - now)/1000);
			if (sleep < 0)
			{
				if (interval == 0)
				{
					sleep = 0;
					break;
				}
				_nextInvocation += static_cast<Timestamp::TimeVal>(interval)*1000;
				++_skipped;
			}
		}
		while (sleep < 0);

		if (_wakeUp.tryWait(sleep))
		{
			Poco::FastMutex::ScopedLock lock(_mutex);
			_nextInvocation.update();
			interval = _periodicInterval;
		}
		else
		{
			try
			{
				_pCallback->invoke(*this);
			}
			catch (Poco::Exception& exc)
			{
				Poco::ErrorHandler::handle(exc);
			}
			catch (std::exception& exc)
			{
				Poco::ErrorHandler::handle(exc);
			}
			catch (...)
			{
				Poco::ErrorHandler::handle();
			}
			interval = _periodicInterval;
		}
		_nextInvocation += static_cast<Timestamp::TimeVal>(interval)*1000;
		_skipped = 0;
	}
	while (interval > 0);
	_done.set();
}
开发者ID:austinsc,项目名称:Poco,代码行数:56,代码来源:Timer.cpp

示例11: main

int main(int argc, char**argv) {
  dsosg::DSOSG *dsosg;
  Poco::Timestamp time;
  bool done;

  osg::ArgumentParser arguments(&argc, argv);
  arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
  arguments.getApplicationUsage()->setDescription("Manual display/camera calibration utility");
  arguments.getApplicationUsage()->addCommandLineOption("--config <filename>","Display server config JSON file");
  arguments.getApplicationUsage()->addCommandLineOption("--display-mode <name>","Display mode");

  osg::ApplicationUsage::Type help = arguments.readHelpType();
  if (help != osg::ApplicationUsage::NO_HELP) {
      arguments.getApplicationUsage()->write(std::cout);
      exit(0);
  }

  std::string config_filename = "~/flyvr-devel/flyvr/flyvr/config/config.json";
  while(arguments.read("--config", config_filename));

  std::string display_mode = "vr_display";
  while(arguments.read("--display-mode", display_mode));

  std::string flyvr_basepath = "/home/john/Programming/flyvr.git/flyvr/";
  float observer_radius = 0.01;
  bool two_pass = false;
  bool show_geom_coords = false;

  osg::Vec3 observer_position(0,0,0);
  osg::Quat observer_orientation(0,0,0,1);

  dsosg = new dsosg::DSOSG(
                        flyvr_basepath,
                        display_mode,
                        observer_radius,
                        config_filename,
                        two_pass,
                        show_geom_coords);

  dsosg->setup_viewer("display_server","{}");
  dsosg->set_stimulus_plugin("Stimulus3DDemo");

  done = false;
  while (!done) {
    float now;

    time.update();
    now = time.epochMicroseconds() * 1e6; /* microseconds to seconds */

    dsosg->update(now, observer_position, observer_orientation);
    dsosg->frame();
    done = dsosg->done();
  }

	return 0;
}
开发者ID:loopbio,项目名称:FreemooVR,代码行数:56,代码来源:main.cpp

示例12: 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

示例13: sleepImpl

void ThreadImpl::sleepImpl(long milliseconds)
{
#if defined(__digital__)
		// This is specific to DECThreads
		struct timespec interval;
		interval.tv_sec  = milliseconds / 1000;
		interval.tv_nsec = (milliseconds % 1000)*1000000;
		pthread_delay_np(&interval);
#elif POCO_OS == POCO_OS_LINUX || POCO_OS == POCO_OS_ANDROID || POCO_OS == POCO_OS_MAC_OS_X || POCO_OS == POCO_OS_QNX || POCO_OS == POCO_OS_VXWORKS
	Poco::Timespan remainingTime(1000*Poco::Timespan::TimeDiff(milliseconds));
	int rc;
	do
	{
		struct timespec ts;
		ts.tv_sec  = (long) remainingTime.totalSeconds();
		ts.tv_nsec = (long) remainingTime.useconds()*1000;
		Poco::Timestamp start;
		rc = ::nanosleep(&ts, 0);
		if (rc < 0 && errno == EINTR)
		{
			Poco::Timestamp end;
			Poco::Timespan waited = start.elapsed();
			if (waited < remainingTime)
				remainingTime -= waited;
			else
				remainingTime = 0;
		}
	}
	while (remainingTime > 0 && rc < 0 && errno == EINTR);
	if (rc < 0 && remainingTime > 0) throw Poco::SystemException("Thread::sleep(): nanosleep() failed");
#else
	Poco::Timespan remainingTime(1000*Poco::Timespan::TimeDiff(milliseconds));
	int rc;
	do
	{
		struct timeval tv;
		tv.tv_sec  = (long) remainingTime.totalSeconds();
		tv.tv_usec = (long) remainingTime.useconds();
		Poco::Timestamp start;
		rc = ::select(0, NULL, NULL, NULL, &tv);
		if (rc < 0 && errno == EINTR)
		{
			Poco::Timestamp end;
			Poco::Timespan waited = start.elapsed();
			if (waited < remainingTime)
				remainingTime -= waited;
			else
				remainingTime = 0;
		}
	}
	while (remainingTime > 0 && rc < 0 && errno == EINTR);
	if (rc < 0 && remainingTime > 0) throw Poco::SystemException("Thread::sleep(): select() failed");
#endif
}
开发者ID:jacklicn,项目名称:macchina.io,代码行数:54,代码来源:Thread_POSIX.cpp

示例14: fillEvaluations

void MultiBiomertricsAutoTuner::fillEvaluations(const Input &sourceDatabaseTrainData,
                                                const Input &targetDatabaseTrainData,
                                                const Settings &settings, std::vector<Evaluation> &evaluations)
{
    int allUnitsCount = settings.params.size();
    Poco::Timestamp stamp;
    #pragma omp parallel for
    for (int i = 0; i < allUnitsCount; i++)
    {
        trainUnit(settings.params[i], sourceDatabaseTrainData, targetDatabaseTrainData, evaluations, i);
    }
    std::cout << "Training individual classifiers took " << (stamp.elapsed()/1000) << "ms";
}
开发者ID:zhuangfangwang,项目名称:face,代码行数:13,代码来源:multibiomertricsautotuner.cpp

示例15: 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


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