• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TimeValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setInputData

void EditNoteDialog::setInputData()
{
    //initialize inputs for new note
    if (mode == CREATE_NEW)
    {
        //set date field value to selected date
        entryDate->set_text(selectedDate.toString());

        //initialize time field as current time +15min
        Glib::DateTime dateTime = Glib::DateTime::create_now_local().add_minutes(Preferences::prefs->getNewNoteMinutes());
        TimeValue timeValue = dateTime;
        entryTime->set_text(timeValue.toString());
    }

    //initialize inputs from existing note
    if (mode == EDIT)
    {
        entryTitle->set_text(noteData->getTitle());
        textDescription->get_buffer()->set_text(noteData->getDetails());
        entryDate->set_text(noteData->getDateText());
        entryTime->set_text(noteData->getTimeText());
        checkReminder->set_active(noteData->isReminder());
    }

}
开发者ID:pzagawa,项目名称:myagenda,代码行数:25,代码来源:EditNoteDialog.cpp


示例2: poll_out

// poll for writing
int Sock::poll_out(TimeValue &timeout)
{
#ifndef _WIN32	
	struct pollfd pollset[1];
	pollset[0].fd = sockfd;
	pollset[0].events = POLLOUT|POLLERR;
	pollset[0].revents = 0;
	int result =  ::poll(pollset, 1, timeout.msec());
	if (result > 0)
		return pollset[0].revents;
	else
		return result;
#else
	fd_set fds_write, fds_err;
	 FD_ZERO(&fds_write);
	 FD_ZERO(&fds_err);
	 FD_SET(sockfd, &fds_write);
	 FD_SET(sockfd, &fds_err);

	 int result = ::select(0, NULL, &fds_write, &fds_err, timeout.timeval());
	 if (result <= 0)
	 	return result;
	 unsigned revents = 0;
	if (FD_ISSET(sockfd, &fds_write)) revents |= POLLOUT;
	if (FD_ISSET(sockfd, &fds_err)) revents |= POLLERR;
	return revents;
#endif
}
开发者ID:handol,项目名称:server,代码行数:29,代码来源:Sock.cpp


示例3: StopMeasurement

int32 RTD::StopMeasurement(void)
{
    TimeValue StopTime;

    StopTime.set_to_current_time();
    return (StopTime.to_msec() - StartTime.to_msec());
}
开发者ID:0omega,项目名称:platform_external_opencore,代码行数:7,代码来源:rtd.cpp


示例4: stream_sp

//----------------------------------------------------------------------
// All logging eventually boils down to this function call. If we have
// a callback registered, then we call the logging callback. If we have
// a valid file handle, we also log to the file.
//----------------------------------------------------------------------
void
Log::VAPrintf(const char *format, va_list args)
{
    // Make a copy of our stream shared pointer in case someone disables our
    // log while we are logging and releases the stream
    StreamSP stream_sp(m_stream_sp);
    if (stream_sp)
    {
        static uint32_t g_sequence_id = 0;
        StreamString header;

        // Add a sequence ID if requested
        if (m_options.Test (LLDB_LOG_OPTION_PREPEND_SEQUENCE))
            header.Printf ("%u ", ++g_sequence_id);

        // Timestamp if requested
        if (m_options.Test (LLDB_LOG_OPTION_PREPEND_TIMESTAMP))
        {
            TimeValue now = TimeValue::Now();
            header.Printf ("%9d.%09.9d ", now.seconds(), now.nanoseconds());
        }

        // Add the process and thread if requested
        if (m_options.Test (LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD))
            header.Printf ("[%4.4x/%4.4" PRIx64 "]: ", getpid(), Host::GetCurrentThreadID());

        // Add the thread name if requested
        if (m_options.Test (LLDB_LOG_OPTION_PREPEND_THREAD_NAME))
        {
            llvm::SmallString<32> thread_name;
            ThisThread::GetName(thread_name);
            if (!thread_name.empty())
                header.Printf ("%s ", thread_name.c_str());
        }

        header.PrintfVarArg (format, args);
        header.PutCString("\n");

        if (m_options.Test(LLDB_LOG_OPTION_BACKTRACE)) 
        {
            std::string back_trace;
            llvm::raw_string_ostream stream(back_trace);
            llvm::sys::PrintStackTrace(stream);
            header.PutCString(back_trace.c_str());
        }

        if (m_options.Test(LLDB_LOG_OPTION_THREADSAFE))
        {
            static Mutex g_LogThreadedMutex(Mutex::eMutexTypeRecursive);
            Mutex::Locker locker(g_LogThreadedMutex);
            stream_sp->PutCString(header.GetString().c_str());
            stream_sp->Flush();
        }
        else
        {
            stream_sp->PutCString(header.GetString().c_str());
            stream_sp->Flush();
        }
    }
}
开发者ID:CTSRD-CHERI,项目名称:lldb,代码行数:65,代码来源:Log.cpp


示例5: PopFreeTimerId

int64_t HeapTimer::RegisterTimer(const TimeValue& interval,
        const TimeValue& delay,
        CallbackObject* cb_obj,
        void* data)
{
    if (interval.Sec() == 0 && interval.Usec() == 0)
        return -1;

    if (cur_size_ >= heap_size_)
        return -1;

    TimerNode* new_node = new TimerNode;
    if (new_node == NULL)
        return -1;

    new_node->cb_obj            = cb_obj;
    new_node->data              = data;
    new_node->timer_id          = PopFreeTimerId();
    new_node->interval_time     = interval;
    new_node->expire_time       = ExpireTime(TimeValue(time(NULL)), delay);

    if (cur_size_ + 2 >= heap_size_)
        GrowHeap();

    RotateUp(new_node, cur_size_, GetParentPos(cur_size_));
    cur_size_++;

    LOG(INFO) << "RegisterTimer TimerSize[" << GetTimerSize() << "] TimerId[" << new_node->timer_id <<"]";

    return new_node->timer_id;
}
开发者ID:altogother,项目名称:PlayFrame,代码行数:31,代码来源:heap_timer.cpp


示例6: GetListeningPort

uint16_t ConnectionFileDescriptor::GetListeningPort(uint32_t timeout_sec)
{
    uint16_t bound_port = 0;
    if (timeout_sec == UINT32_MAX)
        m_port_predicate.WaitForValueNotEqualTo (0, bound_port);
    else
    {
        TimeValue timeout = TimeValue::Now();
        timeout.OffsetWithSeconds(timeout_sec);
        m_port_predicate.WaitForValueNotEqualTo (0, bound_port, &timeout);
    }
    return bound_port;
}
开发者ID:jashank,项目名称:freebsd,代码行数:13,代码来源:ConnectionFileDescriptor.cpp


示例7:

void
RoutingStatsScene::addRp(uint32_t nodeId, QString destination, qreal time, RoutePathElementsVector_t elements)
{
    NodeIdDest_t nd = { nodeId, destination };
    if(m_rps.find(nd) == m_rps.end())
    {
        TimeValue <RoutePathElementsVector_t> tv;
        tv.add(time, elements);
        m_rps[nd] = tv;
        return;
    }
    TimeValue <RoutePathElementsVector_t> & tv = m_rps[nd];
    tv.add(time, elements);
}
开发者ID:DunamisEric,项目名称:RepSys_Manets_NS-3.17,代码行数:14,代码来源:routingstatsscene.cpp


示例8: addToProxyWidgetsMap

void
RoutingStatsScene::add(uint32_t nodeId, qreal time, QString rt)
{
    if(m_nodeIdTimeValues.find(nodeId) == m_nodeIdTimeValues.end())
    {
        TimeValue <QString> tv;
        tv.add(time, rt);
        m_nodeIdTimeValues[nodeId] = tv;
        addToProxyWidgetsMap(nodeId, "", rt);
        return;
    }
    TimeValue <QString> & tv = m_nodeIdTimeValues[nodeId];
    tv.add(time, rt);

}
开发者ID:DunamisEric,项目名称:RepSys_Manets_NS-3.17,代码行数:15,代码来源:routingstatsscene.cpp


示例9: setUpNodeLines

void
PacketsScene::addPackets ()
{
  bool foundNodes = setUpNodeLines ();
  if (!foundNodes)
    return;
  Table * table = PacketsMode::getInstance ()->getTable ();
  table->removeAllRows ();
  uint32_t count = 0;
  uint32_t maxPackets = 10000;

  if (m_packetPathItem)
    {
      removeItem (m_packetPathItem);
    }
  m_packetPathItem = new QGraphicsPathItem;
  addItem (m_packetPathItem);
  m_packetPath = QPainterPath ();
  TimeValue <AnimEvent*> *events = AnimatorMode::getInstance ()->getEvents ();
  for (TimeValue<AnimEvent *>::TimeValue_t::const_iterator i = events->Begin ();
      i != events->End ();
      ++i)
    {
      AnimEvent * ev = i->second;
      if (ev->m_type == AnimEvent::PACKET_FBTX_EVENT)
        {
          AnimPacketEvent * packetEvent = static_cast<AnimPacketEvent *> (ev);
          if (!isAllowedNode (packetEvent->m_fromId))
            continue;
          if (!isAllowedNode (packetEvent->m_toId))
            continue;
          if (packetEvent->m_fbRx > m_toTime)
              continue;
          if (packetEvent->m_fbTx < m_fromTime)
              continue;

          if ((count == maxPackets) && m_showGraph)
            AnimatorMode::getInstance ()->showPopup ("Currently only the first " + QString::number (maxPackets) + " packets will be shown. Table will be fully populated");
          addPacket (packetEvent->m_fbTx, packetEvent->m_fbRx, packetEvent->m_fromId, packetEvent->m_toId, packetEvent->m_metaInfo, count < maxPackets );
          AnimatorMode::getInstance ()->keepAppResponsive ();
          ++count;

        }
    }
  table->adjust ();
  m_infoWidget->setVisible (false);

}
开发者ID:ioannisntokas,项目名称:ns3_team_2A,代码行数:48,代码来源:packetsscene.cpp


示例10: stream_sp

//----------------------------------------------------------------------
// All logging eventually boils down to this function call. If we have
// a callback registered, then we call the logging callback. If we have
// a valid file handle, we also log to the file.
//----------------------------------------------------------------------
void
Log::PrintfWithFlagsVarArg (uint32_t flags, const char *format, va_list args)
{
    // Make a copy of our stream shared pointer in case someone disables our
    // log while we are logging and releases the stream
    StreamSP stream_sp(m_stream_sp);
    if (stream_sp)
    {
        static uint32_t g_sequence_id = 0;
        StreamString header;
		// Enabling the thread safe logging actually deadlocks right now.
		// Need to fix this at some point.
//        static Mutex g_LogThreadedMutex(Mutex::eMutexTypeRecursive);
//        Mutex::Locker locker (g_LogThreadedMutex);

        // Add a sequence ID if requested
        if (m_options.Test (LLDB_LOG_OPTION_PREPEND_SEQUENCE))
            header.Printf ("%u ", ++g_sequence_id);

        // Timestamp if requested
        if (m_options.Test (LLDB_LOG_OPTION_PREPEND_TIMESTAMP))
        {
            TimeValue now = TimeValue::Now();
            header.Printf ("%9d.%6.6d ", now.seconds(), now.nanoseconds());
        }

        // Add the process and thread if requested
        if (m_options.Test (LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD))
            header.Printf ("[%4.4x/%4.4" PRIx64 "]: ", getpid(), Host::GetCurrentThreadID());

        // Add the process and thread if requested
        if (m_options.Test (LLDB_LOG_OPTION_PREPEND_THREAD_NAME))
        {
            std::string thread_name (Host::GetThreadName (getpid(), Host::GetCurrentThreadID()));
            if (!thread_name.empty())
                header.Printf ("%s ", thread_name.c_str());
        }

        header.PrintfVarArg (format, args);
        stream_sp->Printf("%s\n", header.GetData());
        
        if (m_options.Test (LLDB_LOG_OPTION_BACKTRACE))
            Host::Backtrace (*stream_sp, 1024);
        stream_sp->Flush();
    }
}
开发者ID:AAZemlyanukhin,项目名称:freebsd,代码行数:51,代码来源:Log.cpp


示例11: on_defaultDurationChanged

void ConstraintPresenter::on_defaultDurationChanged(const TimeValue& val)
{
    auto width = val.toPixels(m_zoomRatio);
    m_view->setDefaultWidth(width);
    m_header->setWidth(width);

    if(rack())
    {
        rack()->setWidth(m_view->defaultWidth() - 20);
    }
}
开发者ID:OpenDAWN,项目名称:i-score,代码行数:11,代码来源:ConstraintPresenter.cpp


示例12: logQueryStats

void DataCollectorSolver::logQueryStats(const Query &query,
        QueryType type, TimeValue start, Solver::Validity validity) {
    int result;

    TimeValue duration = TimeValue::now() - start;
    std::string query_blob;
    std::pair<uint64_t, uint64_t> qids = serializer_.Serialize(query, query_blob);

    // Query structure
    sqlite3_clear_bindings(qinsert_stmt_);

    sqlite3_bind_int64(qinsert_stmt_, 1, qids.first);
    if (qids.second) {
        sqlite3_bind_int64(qinsert_stmt_, 2, qids.second);
    }
    sqlite3_bind_int64(qinsert_stmt_, 14,
            event_logger_->logEvent(g_s2e_state, EVENT_KLEE_QUERY, 1));

    sqlite3_bind_int(qinsert_stmt_, 3, query.constraints.head()->depth());
    sqlite3_bind_blob(qinsert_stmt_, 4,
            query_blob.c_str(), query_blob.size(), NULL);
    sqlite3_bind_int(qinsert_stmt_, 5, static_cast<int>(type));

    result = sqlite3_step(qinsert_stmt_);
    assert(result == SQLITE_DONE);
    sqlite3_reset(qinsert_stmt_);

    // Query results
    sqlite3_bind_int64(rinsert_stmt_, 1, qids.first);
    sqlite3_bind_int64(rinsert_stmt_, 2, duration.usec());
    if (type == TRUTH || type == VALIDITY) {
        sqlite3_bind_int(rinsert_stmt_, 3, static_cast<int>(validity));
    }
    result = sqlite3_step(rinsert_stmt_);
    assert(result == SQLITE_DONE);
    sqlite3_reset(rinsert_stmt_);
}
开发者ID:AmesianX,项目名称:chef,代码行数:37,代码来源:DataCollectorSolver.cpp


示例13: defined

LNE_UINT ThreadMutex::Acquire(const TimeValue &tv)
{
	if(!IsAvailable())
		return LNERR_NOINIT;
#if defined(LNE_WIN32)
	DWORD ret = WaitForSingleObject(mutex_, (DWORD)tv.ToMillisecond());
	if(ret == WAIT_OBJECT_0)
		return LNERR_OK;
	if(ret == WAIT_TIMEOUT)
		return LNERR_TIMEOUT;
#else
	struct timespec ts;
	TimeValue dest;
	dest.Now();
	dest += tv;
	ts.tv_sec = dest.sec();
	ts.tv_nsec = dest.usec() * 1000;
	if(pthread_mutex_timedlock(&mutex_, &ts) == 0)
		return LNERR_OK;
	if(errno == ETIMEDOUT)
		return LNERR_TIMEOUT;
#endif
	return LNERR_UNKNOW;
}
开发者ID:breezechen,项目名称:lne,代码行数:24,代码来源:ThreadMutex.cpp


示例14: update

void Bullet::update(TimeValue time)
{
    if (isUpdating())
        dynamicsWorld_->stepSimulation(time.toSeconds(), 8, getSubstepSize().toSeconds());
}
开发者ID:savant-nz,项目名称:carbon,代码行数:5,代码来源:Bullet.cpp


示例15: on_minDurationChanged

void ConstraintPresenter::on_minDurationChanged(const TimeValue& min)
{
    m_view->setMinWidth(min.toPixels(m_zoomRatio));
}
开发者ID:OpenDAWN,项目名称:i-score,代码行数:4,代码来源:ConstraintPresenter.cpp


示例16: on_maxDurationChanged

void ConstraintPresenter::on_maxDurationChanged(const TimeValue& max)
{
    m_view->setMaxWidth(max.isInfinite(),
                        max.isInfinite()? -1 : max.toPixels(m_zoomRatio));
}
开发者ID:OpenDAWN,项目名称:i-score,代码行数:5,代码来源:ConstraintPresenter.cpp


示例17: if

int	SockConnector::connect(SockStream &stream, InetAddr &addr, TimeValue &tv)
{	
	int rv = 0;

	// non-block socket
	stream.set_nonblocking();
	
	#ifdef _WIN32

	// connect
	rv = ::connect(stream.get_handle(), (const struct sockaddr *) addr.get_addr(), (socklen_t)addr.get_addr_size());
	if (rv != -1) {
		rv = 0;
	}
	else  {
		if (WSAGetLastError() == WSAEWOULDBLOCK) 
		{
			//printf("connect InProgress [%d]\n", sock);
			fd_set rset;
			fd_set wset;

			FD_ZERO(&rset);
			FD_ZERO(&wset);
			FD_SET(stream.get_handle(), &rset);			
			FD_SET(stream.get_handle(), &wset);			
			
			rv = ::select(0, &rset, &wset, NULL, (struct  timeval*)tv.timeval());
			if (rv == 0) {				
				perror("connect timeout");
				rv = -1;
			}
			else if (FD_ISSET(stream.get_handle(), &rset) || FD_ISSET(stream.get_handle(), &wset)) {
				int error = 0;
				socklen_t len = sizeof(error);
				if (getsockopt(stream.get_handle(), SOL_SOCKET, SO_ERROR, (char *)&error, &len) == 0) {
					// select error
					if (error == 0) {
						rv = 0;
					}
					else {
						closesocket(stream.get_handle());						
						perror("connect");		
						rv = -1;
					}	
				}
			}
			else {
				perror("connect");		
				rv = -1;

			}
		} 
		else {
			perror("connect");
			rv = -1;
		}
	}
	#endif

	// restore file status flags
	stream.set_blocking();
	
	return rv;
}
开发者ID:handol,项目名称:server,代码行数:64,代码来源:SockConnector.cpp


示例18: time

//// Other conversions
inline OSSIA::TimeValue time(const TimeValue& t)
{
    return t.isInfinite()
            ? OSSIA::Infinite
            : OSSIA::TimeValue{t.msec()};
}
开发者ID:OpenDAWN,项目名称:i-score,代码行数:7,代码来源:iscore2OSSIA.hpp


示例19: setDefaultDuration

void View::setDefaultDuration(const TimeValue& t)
{
    auto qtime = t.toQTime();
    if(qtime != m_defaultDur->time())
        m_defaultDur->setTime(qtime);
}
开发者ID:himito,项目名称:i-score,代码行数:6,代码来源:View.cpp


示例20: verifyInputData

void EditNoteDialog::verifyInputData()
{
    const Glib::ustring title = entryTitle->get_text();
    const Glib::ustring desc = textDescription->get_buffer()->get_text(false);
    const Glib::ustring date = entryDate->get_text();
    const Glib::ustring time = entryTime->get_text();
    const bool isReminder = checkReminder->get_active();

    bool title_valid = false;
    bool date_valid = false;
    bool time_valid = false;

    //check title
    if (title.length() > 0)
    {
        title_valid = true;
    }

    //check date
    DateValue dateValue;
    if (dateValue.parseString(date))
    {
        date_valid = true;
    }

    //check time
    TimeValue timeValue;
    if (timeValue.parseString(time))
    {
        time_valid = true;
    }

    if (title_valid && date_valid && time_valid)
    {
        isInputDataValid = true;

        btnSave->set_sensitive(true);
        infoBar->setText(Gtk::MESSAGE_INFO, lang::getString(lang::EDIT_NOTE_INPUT_VALIDATED));

        //update note data
        noteData->setDate(dateValue);
        noteData->setTime(timeValue);
        noteData->setReminder(isReminder);
        noteData->setTitle(title);
        noteData->setDetails(desc);
    }
    else
    {
        isInputDataValid = false;

        btnSave->set_sensitive(false);

        std::string message = lang::getString(lang::EDIT_NOTE_INPUT_NOT_VALIDATED);

        if (!title_valid)
            message = lang::getString(lang::EDIT_NOTE_INPUT_CORRECT_TITLE);

        if (title_valid && !date_valid)
            message = lang::getString(lang::EDIT_NOTE_INPUT_CORRECT_DATE);

        if (title_valid && date_valid && !time_valid)
            message = lang::getString(lang::EDIT_NOTE_INPUT_CORRECT_TIME);

        infoBar->setText(Gtk::MESSAGE_ERROR, message);
    }
}
开发者ID:pzagawa,项目名称:myagenda,代码行数:66,代码来源:EditNoteDialog.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TimeZone类代码示例发布时间:2022-05-31
下一篇:
C++ TimeUnit类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap