您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Duration函数代码示例

51自学网 2021-06-01 20:30:33
  C++
这篇教程C++ Duration函数代码示例写得很实用,希望能帮到您。

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

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

示例1: UTIL_ScreenFade

//-----------------------------------------------------------------------------// Purpose: Input handler that does the screen fade.//-----------------------------------------------------------------------------void CEnvFade::InputFade( inputdata_t &inputdata ){	int fadeFlags = 0;	if ( m_spawnflags & SF_FADE_IN )	{		fadeFlags |= FFADE_IN;	}	else	{		fadeFlags |= FFADE_OUT;	}	if ( m_spawnflags & SF_FADE_MODULATE )	{		fadeFlags |= FFADE_MODULATE;	}	if ( m_spawnflags & SF_FADE_STAYOUT )	{		fadeFlags |= FFADE_STAYOUT;	}	if ( m_spawnflags & SF_FADE_ONLYONE )	{		if ( inputdata.pActivator->IsNetClient() )		{			UTIL_ScreenFade( inputdata.pActivator, m_clrRender, Duration(), HoldTime(), fadeFlags );		}	}	else	{		UTIL_ScreenFadeAll( m_clrRender, Duration(), HoldTime(), fadeFlags|FFADE_PURGE );	}	m_OnBeginFade.FireOutput( inputdata.pActivator, this );}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:40,


示例2: ROS_INFO

bool ObjectManipulation::placeObject(string arm_name, double x_offset, double y_offset, double z_offset, double max_seconds_wait_for_conclusion) {	if (processing_srv_.response.graspable_objects.empty() || processing_srv_.response.collision_object_names.empty()) {		return false;	}	geometry_msgs::PoseStamped place_location;	place_location.header.frame_id = processing_srv_.response.graspable_objects.at(0).reference_frame_id;	place_location.pose.orientation.w = 1;	place_location.header.stamp = ros::Time::now();	place_location.pose.position.x += x_offset;	place_location.pose.position.y += y_offset;	direction_.header.stamp = ros::Time::now();	direction_.header.frame_id = "base_link";	direction_.vector.x = 0;	direction_.vector.y = 0;	direction_.vector.z = -1;	ROS_INFO("Calling the place action");	object_manipulation_msgs::PlaceGoal place_goal;	place_goal.place_locations.push_back(place_location);	place_goal.collision_object_name = processing_srv_.response.collision_object_names.at(0);	place_goal.collision_support_surface_name = processing_srv_.response.collision_support_surface_name;	place_goal.grasp = pickup_result_.grasp;	place_goal.arm_name = arm_name;	place_goal.place_padding = 0.02;	place_goal.desired_retreat_distance = 0.1;	place_goal.min_retreat_distance = 0.05;	place_goal.approach.direction = direction_;	place_goal.approach.desired_distance = z_offset;	place_goal.approach.min_distance = 0.05;	place_goal.use_reactive_place = false;	place_client_.sendGoal(place_goal);	ROS_INFO("Waiting for the place action...");	if (!place_client_.waitForResult(Duration(max_seconds_wait_for_conclusion))) {		return false;	}	object_manipulation_msgs::PlaceResult place_result = *(place_client_.getResult());	if (place_client_.getState() != actionlib::SimpleClientGoalState::SUCCEEDED) {		ROS_ERROR("Place failed with error code %d", place_result.manipulation_result.value);		return false;	}	ROS_INFO("Object moved");	return true;}
开发者ID:carlosmccosta,项目名称:Robot-Object-Manipulation,代码行数:49,


示例3: Duration

////////////////////////////////////////////////////////////////////////////////// Set the minimum and maximum widths for the value.void ColumnRecur::measure (Task& task, unsigned int& minimum, unsigned int& maximum){  if (_style == "default" ||      _style == "duration")  {    minimum = maximum = Duration (task.get ("recur")).formatCompact ().length ();  }  else if (_style == "indicator")  {    if (task.has (_name))      minimum = maximum = context.config.get ("recurrence.indicator").length ();  }  else    throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);}
开发者ID:nigeil,项目名称:task,代码行数:17,


示例4: date

////////////////////////////////////////////////////////////////////////////////// Set the minimum and maximum widths for the value.void ColumnDue::measure (Task& task, int& minimum, int& maximum){  minimum = maximum = 0;  if (task.has (_name))  {    if (_style == "countdown")    {      Date date ((time_t) strtol (task.get (_name).c_str (), NULL, 10));      Date now;      minimum = maximum = Duration (now - date).format ().length ();    }    else      ColumnDate::measure (task, minimum, maximum);  }}
开发者ID:SEJeff,项目名称:task,代码行数:18,


示例5: TimeToPixels

void TExportZone::TrackOutMarker(BPoint mousePt){						//	Constrain to out time of cue sheet	uint32 outPixels = TimeToPixels( Duration() - StartTime(), GetCurrentTimeFormat(), GetCurrentResolution());		if (mousePt.x > outPixels)		mousePt.x = outPixels;	//	Don't allow overlap with m_InRect	if ( (mousePt.x-kExportSliderWidth) < m_InRect.right)		mousePt.x = m_InRect.right + kExportSliderWidth;	// Save oldRect for redraw															BRect oldRect 	= m_OutRect;		m_OutRect.right = mousePt.x;		m_OutRect.left = m_OutRect.right - kExportSliderWidth;				// Exit if there is no change in position	if (oldRect == m_OutRect)		return;	//	Update m_ExportChannel	m_ExportChannel.right = m_OutRect.left;		//	Clean up old position	BRect updateRect = oldRect;		if (m_OutRect.left <= oldRect.left)	{		updateRect.left = m_OutRect.left;			}	else	{		updateRect.right  = m_OutRect.right;	}		Draw(updateRect);		//	Update CueSheet variable	uint32 newOutTime = StartTime() + PixelsToTime(m_OutRect.right, GetCurrentTimeFormat(), GetCurrentResolution());	m_CueSheetWindow->GetCueSheetView()->SetExportStopTime(newOutTime);	//	Update text	m_CueSheetWindow->GetExportTimeView()->DrawOutText();	}
开发者ID:ModeenF,项目名称:UltraDV,代码行数:47,


示例6: segment_time_elapsed

MoveSpline::UpdateResult MoveSpline::_updateState(int32& ms_time_diff){	if (ms_time_diff < 0)	{		ms_time_diff = 0;		return Result_Arrived;	}    if (Finalized())    {        ms_time_diff = 0;        return Result_Arrived;    }    UpdateResult result = Result_None;    int32 minimal_diff = std::min(ms_time_diff, segment_time_elapsed());    ASSERT(minimal_diff >= 0);    time_passed += minimal_diff;    ms_time_diff -= minimal_diff;    if (time_passed >= next_timestamp())    {        ++point_Idx;        if (point_Idx < spline.last())        {            result = Result_NextSegment;        }        else        {            if (spline.isCyclic())            {                point_Idx = spline.first();                time_passed = time_passed % Duration();                result = Result_NextSegment;            }            else            {                _Finalize();                ms_time_diff = 0;                result = Result_Arrived;            }        }    }    return result;}
开发者ID:Expecto,项目名称:FCore,代码行数:47,


示例7: Duration

DurationTime::operator-(const rclcpp::Time & rhs) const{  if (rcl_time_.clock_type != rhs.rcl_time_.clock_type) {    throw std::runtime_error("can't subtract times with different time sources");  }  if (rclcpp::sub_will_overflow(rcl_time_.nanoseconds, rhs.rcl_time_.nanoseconds)) {    throw std::overflow_error("time subtraction leads to int64_t overflow");  }  if (rclcpp::sub_will_underflow(rcl_time_.nanoseconds, rhs.rcl_time_.nanoseconds)) {    throw std::underflow_error("time subtraction leads to int64_t underflow");  }  return Duration(rcl_time_.nanoseconds - rhs.rcl_time_.nanoseconds);}
开发者ID:jwang11,项目名称:rclcpp,代码行数:17,


示例8: assert

//--------------------------------------------------------------------------------------// Name: GetPacketCumulativeBytesSize()// Desc: Gets the packet count and the total byte size of the 'dpds' chunk.//--------------------------------------------------------------------------------------HRESULT WaveFile::GetPacketCumulativeBytesSize(DWORD* pdwPacketCount, DWORD* pdwBufferSize){    assert( m_DpdsChunk.IsValid() );    if (!m_DpdsChunk.IsValid())        return E_HANDLE;    WAVEFORMATEXTENSIBLE wfxFormat;    GetFormat( &wfxFormat );        // Packet count: length of the 'data' chunk divided by number of bytes per packet    *pdwPacketCount = Duration() / wfxFormat.Format.nBlockAlign;    *pdwBufferSize = m_DpdsChunk.GetDataSize();    return S_OK;}
开发者ID:AlexSincennes,项目名称:CSCI522A6,代码行数:21,


示例9: DoGameMove

void DoGameMove(GAME *Game, int Move, double Value, double Time) {   if (! IsLegalMove(Game->Board,Move)) FatalError("Illegal move in DoGameMove()");   TurnTime = (Trust && Time >= 0.0) ? Time : Duration(TurnBegin,CurrentTime());   ElapsedTime[Game->Board->Colour>0] += TurnTime;   DoMove(Game->Board,Move);   Game->Move[Game->MoveNo].Move  = Move;   Game->Move[Game->MoveNo].Value = Value;   Game->Move[Game->MoveNo].Time  = TurnTime;   Game->MoveNo++;   Game->Move[Game->MoveNo].Move  = NO_MOVE;   TurnBegin = CurrentTime();}
开发者ID:zhu-jz,项目名称:turtle,代码行数:17,


示例10: Draw

//-----------------------------------------------------------------------void DebugNavigator::Draw(DrawingContext & drawingContext){    constexpr float minFramerate = 10.0f;    constexpr float maxFramerate = 60.0f;    constexpr std::uint16_t maxHistories = 20;    {        if (clock->TotalGameTime() - duration > Duration(0.2))        {            auto frameRate = clock->FrameRate();            frameRateString = StringFormat("%4.2f fps", frameRate);            frameRates.push_back(MathHelper::Clamp(frameRate, minFramerate, maxFramerate));            if (frameRates.size() > maxHistories)            {                frameRates.pop_front();            }            duration = clock->TotalGameTime();        }    }    auto transform = Transform() * drawingContext.Top();    {        auto graphTransform = Matrix3x2::CreateTranslation(Vector2{0, 16}) * transform;        constexpr std::uint16_t maxGraphHeight = 26;        constexpr float graphMarginLeft = 1.0f;        auto graghWidth = (static_cast<float>(Width()) / maxHistories);        std::int32_t startPosition = graghWidth * (maxHistories - frameRates.size());        std::int32_t graphX = startPosition;        for (auto & frameRate: frameRates)        {            auto amount = ((frameRate - minFramerate) / (maxFramerate - minFramerate));            auto graphHeight = MathHelper::Clamp<std::uint16_t>(maxGraphHeight * amount, 1, maxGraphHeight);            drawingContext.DrawRectangle(graphTransform, Color::CornflowerBlue,                Rectangle(graphX, maxGraphHeight - graphHeight, graghWidth - graphMarginLeft, graphHeight));            graphX += graghWidth;        }    }    drawingContext.DrawString(transform * Matrix3x2::CreateTranslation({0.5f, -2.5f}),        Color::White, FontWeight::Bold, FontSize::Medium, frameRateString);}
开发者ID:Mourtz,项目名称:pomdog,代码行数:47,


示例11: get_state

 void IBeamTool::set_leading_x (const int x) {   shared_ptr<TimelineState> state = get_state();      // The line below needs handled differently now;  ////////////TODO GTK-3   //   //const bool set_playback_period = dragType == Selection;      TimeVar newStartPoint (state->getViewWindow().x_to_time(x));   Offset selectionLength (pinnedDragTime, newStartPoint);      if (newStartPoint > pinnedDragTime)     newStartPoint=pinnedDragTime; // use the smaller one as selection start      selectionControl (TimeSpan (newStartPoint, Duration(selectionLength))); }
开发者ID:Ichthyostega,项目名称:Lumiera,代码行数:17,


示例12: AverageFrameLength

int64_tMP3Demuxer::Duration() const {  if (!mNumParsedFrames) {    return -1;  }  // Assume we know the exact number of frames from the VBR header.  int64_t numFrames = mParser.VBRInfo().NumFrames();  if (numFrames < 0) {    if (mStreamLength < 0) {      // Unknown length, we can't estimate duration.      return -1;    }    numFrames = (mStreamLength - mFirstFrameOffset) / AverageFrameLength();  }  return Duration(numFrames);}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:17,


示例13: parse

  static Try<Duration> parse(const std::string& s)  {    // TODO(benh): Support negative durations (i.e., starts with '-').    size_t index = 0;    while (index < s.size()) {      if (isdigit(s[index]) || s[index] == '.') {        index++;        continue;      }      Try<double> value = numify<double>(s.substr(0, index));      if (value.isError()) {        return Error(value.error());      }      const std::string unit = s.substr(index);      if (unit == "ns") {        return Duration(value.get(), NANOSECONDS);      } else if (unit == "us") {        return Duration(value.get(), MICROSECONDS);      } else if (unit == "ms") {        return Duration(value.get(), MILLISECONDS);      } else if (unit == "secs") {        return Duration(value.get(), SECONDS);      } else if (unit == "mins") {        return Duration(value.get(), MINUTES);      } else if (unit == "hrs") {        return Duration(value.get(), HOURS);      } else if (unit == "days") {        return Duration(value.get(), DAYS);      } else if (unit == "weeks") {        return Duration(value.get(), WEEKS);      } else {        return Error(            "Unknown duration unit '" + unit + "'; supported units are"            " 'ns', 'us', 'ms', 'secs', 'mins', 'hrs', 'days', and 'weeks'");      }    }    return Error("Invalid duration '" + s + "'");  }
开发者ID:wzqtony,项目名称:mesos,代码行数:42,


示例14: switch

Duration Duration::fromString(const QString &s, Format format, bool *ok) {    if (ok) *ok = false;    QRegExp matcher;    Duration tmp;    switch (format) {        case Format_Hour: {            matcher.setPattern("^(//d*)h(//d*)m$" );            int pos = matcher.indexIn(s);            if (pos > -1) {                tmp.addHours(matcher.cap(1).toUInt());                tmp.addMinutes(matcher.cap(2).toUInt());                if (ok) *ok = true;            }            break;        }        case Format_DayTime: {            matcher.setPattern("^(//d*) (//d*):(//d*):(//d*)//.(//d*)$" );            int pos = matcher.indexIn(s);            if (pos > -1) {                tmp.addDays(matcher.cap(1).toUInt());                tmp.addHours(matcher.cap(2).toUInt());                tmp.addMinutes(matcher.cap(3).toUInt());                tmp.addSeconds(matcher.cap(4).toUInt());                tmp.addMilliseconds(matcher.cap(5).toUInt());                if (ok) *ok = true;            }            break;        }        case Format_HourFraction: {            // should be in double format            bool res;            double f = QLocale().toDouble(s, &res);            if (ok) *ok = res;            if (res) {                return Duration((qint64)(f)*3600*1000);            }            break;        }        default:            qFatal("Unknown format");            break;    }    return tmp;}
开发者ID:KDE,项目名称:calligra,代码行数:44,


示例15: date

////////////////////////////////////////////////////////////////////////////////// Set the minimum and maximum widths for the value.//void ColumnUDA::measure (Task& task, int& minimum, int& maximum){  minimum = maximum = 0;  if (_style == "default")  {    std::string value = task.get (_name);    if (value != "")    {      if (_type == "date")      {        // Determine the output date format, which uses a hierarchy of definitions.        //   rc.report.<report>.dateformat        //   rc.dateformat.report        //   rc.dateformat.        Date date ((time_t) strtol (value.c_str (), NULL, 10));        std::string format = context.config.get ("report." + _report + ".dateformat");        if (format == "")          format = context.config.get ("dateformat.report");        if (format == "")          format = context.config.get ("dateformat");        minimum = maximum = date.toString (format).length ();      }      else if (_type == "duration")      {        minimum = maximum = Duration (value).formatCompact ().length ();      }      else if (_type == "string")      {        std::string stripped = Color::strip (value);        maximum = longestLine (stripped);        minimum = longestWord (stripped);      }      else if (_type == "numeric")      {        minimum = maximum = value.length ();      }    }  }  else    throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);}
开发者ID:codito,项目名称:task,代码行数:46,


示例16: GetId

std::string MoveSpline::ToString() const{    std::stringstream str;    str << "MoveSpline" << std::endl;    str << "spline Id: " << GetId() << std::endl;    str << "flags: " << splineflags.ToString() << std::endl;    if (splineflags.final_angle)        str << "facing  angle: " << facing.angle;    else if (splineflags.final_target)        str << "facing target: " << facing.target;    else if (splineflags.final_point)        str << "facing  point: " << facing.f.x << " " << facing.f.y << " " << facing.f.z;    str << std::endl;    str << "time passed: " << time_passed << std::endl;    str << "total  time: " << Duration() << std::endl;    str << "spline point Id: " << point_Idx << std::endl;    str << "path  point  Id: " << currentPathIdx() << std::endl;    str << spline.ToString();    return str.str();}
开发者ID:AtVirus,项目名称:Forgotten-Lands-Source,代码行数:20,


示例17: GetId

std::string MoveSpline::ToString() const{    std::stringstream str;    str << "MoveSpline" << std::endl;    str << "spline Id: " << GetId() << std::endl;    str << "flags: " << splineflags.ToString() << std::endl;    if (facing.type == MONSTER_MOVE_FACING_ANGLE)        str << "facing  angle: " << facing.angle;    else if (facing.type == MONSTER_MOVE_FACING_TARGET)        str << "facing target: " << facing.target.ToString();    else if (facing.type == MONSTER_MOVE_FACING_SPOT)        str << "facing  point: " << facing.f.x << " " << facing.f.y << " " << facing.f.z;    str << std::endl;    str << "time passed: " << time_passed << std::endl;    str << "total  time: " << Duration() << std::endl;    str << "spline point Id: " << point_Idx << std::endl;    str << "path  point  Id: " << currentPathIdx() << std::endl;    str << spline.ToString();    return str.str();}
开发者ID:Diyvol,项目名称:TrinityCore,代码行数:20,


示例18: FadeOutFx

/*================idEntityFx::Event_Trigger================*/void idEntityFx::Event_Trigger( idEntity *activator ) {	if ( g_skipFX.GetBool() ) {		return;	}	float		fxActionDelay;	const char *fx;	if ( gameLocal.time < nextTriggerTime ) {		return;	}	if ( spawnArgs.GetString( "fx", "", &fx) ) {				//ivan start		if( manualRemove ){ //new case			if( started >= 0 && !manualFadeIsOn && spawnArgs.GetBool( "toggle", "0") ){ //if it is active && toggle is set				FadeOutFx();			}else{				Setup( fx );				Start( gameLocal.time ); //don't autokill			}		}else{ //old case		//ivan end			Setup( fx );			Start( gameLocal.time );			PostEventMS( &EV_Fx_KillFx, Duration() );		}		BecomeActive( TH_THINK );	}	fxActionDelay = spawnArgs.GetFloat( "fxActionDelay" );	if ( fxActionDelay != 0.0f ) {		nextTriggerTime = gameLocal.time + SEC2MS( fxActionDelay );	} else {		// prevent multiple triggers on same frame		nextTriggerTime = gameLocal.time + 1;	}	PostEventSec( &EV_Fx_Action, fxActionDelay, activator );}
开发者ID:alepulver,项目名称:dhewm3,代码行数:46,


示例19: if

bool MythProgramInfo::IsSetup() const{    if (m_flags)        return true;    m_flags |= FLAGS_INITIALIZED;    if (m_proginfo)    {        // Has Artworks ?        for (std::vector<Myth::Artwork>::const_iterator it = m_proginfo->artwork.begin(); it != m_proginfo->artwork.end(); ++it)        {            if (it->type == "coverart")                m_flags |= FLAGS_HAS_COVERART;            else if (it->type == "fanart")                m_flags |= FLAGS_HAS_FANART;            else if (it->type == "banner")                m_flags |= FLAGS_HAS_BANNER;        }        // Is Visible ?        // Filter out recording of special storage group Deleted        // Filter out recording with duration less than 5 seconds        // When  deleting a recording, it might not be deleted immediately but marked as 'pending delete'.        // Depending on the protocol version the recording is moved to the group Deleted or        // the 'delete pending' flag is set        if (Duration() >= 5)        {            if (RecordingGroup() == "Deleted" || IsDeletePending())                m_flags |= FLAGS_IS_DELETED;            else                m_flags |= FLAGS_IS_VISIBLE;        }        // Is LiveTV ?        if (RecordingGroup() == "LiveTV")            m_flags |= FLAGS_IS_LIVETV;    }    return true;}
开发者ID:jshattoc,项目名称:pvr.mythtv,代码行数:40,


示例20: updateOffsets

DECLARE_EXPORT void CalendarBucket::updateOffsets(){  if (days==127 && !starttime && endtime==Duration(86400L))  {    // Bucket is effective continuously. No need to update the structure.    offsetcounter = 0;    return;  }  offsetcounter = -1;  short tmp = days;  for (short i=0; i<=6; ++i)  {    // Loop over all days in the week    if (tmp & 1)    {      if (offsetcounter>=1 && (offsets[offsetcounter] == 86400*i + starttime))        // Special case: the start date of todays offset entry        // is the end date yesterdays entry. We can just update the        // end date of that entry.        offsets[offsetcounter] = 86400*i + endtime;      else      {        // New offset pair        offsets[++offsetcounter] = 86400*i + starttime;        offsets[++offsetcounter] = 86400*i + endtime;      }    }    tmp = tmp>>1; // Shift to the next bit  }  // Special case: there is no gap between the end of the last event in the  // week and the next event in the following week.  if (offsetcounter >= 1 && offsets[0]==0 && offsets[offsetcounter]==86400*7)  {    offsets[0] = offsets[offsetcounter-1] - 86400*7;    offsets[offsetcounter] = 86400*7 + offsets[1];  }}
开发者ID:ElevimRG,项目名称:frePPLe,代码行数:39,


示例21: Window

void TExportZone::HandleDoubleClick(BPoint where){	//	Get window bounds	const BRect winBounds = Window()->Bounds();		//	Get cue sheet bounds	const BRect bounds = Bounds();		//	Get total pixel length for bounds checking	int32 pixelWidth = TimeToPixels( Duration(), GetCurrentTimeFormat(), GetCurrentResolution() );		//	Update tracking rects	m_InRect.left 	= bounds.left;	m_InRect.right 	= m_InRect.left + kExportSliderWidth;	//	Set up out rect.  Check for right side length bounds violation	int32 outRight = (bounds.left + winBounds.Width()) - kHeaderWidth;	if (outRight > pixelWidth)		outRight = pixelWidth;		m_OutRect.right	 = outRight;	m_OutRect.left 	 = m_OutRect.right - kExportSliderWidth;		//	Update m_ExportChannel	m_ExportChannel.left  = m_InRect.right;	m_ExportChannel.right = m_OutRect.left;		//	Update cue sheet variables	m_CueSheetWindow->GetCueSheetView()->SetExportStartTime( PixelsToTime(m_InRect.left, GetCurrentTimeFormat(), GetCurrentResolution()) );	m_CueSheetWindow->GetCueSheetView()->SetExportStopTime( PixelsToTime(m_OutRect.right, GetCurrentTimeFormat(), GetCurrentResolution()) );		//	Update text items	m_CueSheetWindow->GetExportTimeView()->DrawInText();	m_CueSheetWindow->GetExportTimeView()->DrawOutText();	//	Redraw	Invalidate();}
开发者ID:ModeenF,项目名称:UltraDV,代码行数:38,


示例22: rightJustify

void ColumnRecur::render (  std::vector <std::string>& lines,  Task& task,  int width,  Color& color){  if (_style == "default" ||      _style == "duration")  {    lines.push_back (      color.colorize (        rightJustify (          Duration (task.get ("recur")).formatCompact (),          width)));  }  else if (_style == "indicator")  {    if (task.has (_name))      lines.push_back (        color.colorize (          rightJustify (context.config.get ("recurrence.indicator"), width)));  }}
开发者ID:nigeil,项目名称:task,代码行数:23,


示例23: switch

static Duration operator % (const QDateTime &dt, PeriodType::Base b){	switch(b)	{	case PeriodType::Min:		return Duration(0, 0, 0, QTime(0, 0, dt.time().second()));	case PeriodType::Hour:		return Duration(0, 0, 0, QTime(0, dt.time().minute(), dt.time().second()));	case PeriodType::Day:		return Duration(0, 0, 0, dt.time());	case PeriodType::Month:		return Duration(0, 0, dt.date().day(), dt.time());	case PeriodType::Year:		return Duration(0, dt.date().month(), dt.date().day(), dt.time());	default:		return Duration();	}}
开发者ID:obrpasha,项目名称:votlis_krizh_gaz_nas,代码行数:18,


示例24: sleep

bool Rate::sleep(){  Time expected_end = start_ + expected_cycle_time_;  Time actual_end = Time::now();  // detect backward jumps in time  if (actual_end < start_)  {    expected_end = actual_end + expected_cycle_time_;  }  //calculate the time we'll sleep for  Duration sleep_time = expected_end - actual_end;  //set the actual amount of time the loop took in case the user wants to know  actual_cycle_time_ = actual_end - start_;  //make sure to reset our start time  start_ = expected_end;  //if we've taken too much time we won't sleep  if(sleep_time <= Duration(0.0))  {    // if we've jumped forward in time, or the loop has taken more than a full extra    // cycle, reset our cycle    if (actual_end > expected_end + expected_cycle_time_)    {      start_ = actual_end;    }    // return false to show that the desired rate was not met    return false;  }  return sleep_time.sleep();}
开发者ID:C-peng,项目名称:librealsense,代码行数:36,


示例25: while

void Application::process_game(){	int time = 1;	while (true)	{		if (time == 1)		{			time = 15;		}		else		{			time -= 1;		}		m_GUI->Timer->Update(time);		if (time == 15)		{			update();			m_GUI->DescriptionBox->add_item_control(new GUI_Text("Ход - " + std::to_string(m_game_turn) + ".", new GUI_TextFormat(10, 19, RGBA_t(0.0, 0.8, 0.0, 1.0))));			m_game_turn += 1;		}		std::chrono::milliseconds Duration(250);		std::this_thread::sleep_for(Duration);	}}
开发者ID:DenisAloner,项目名称:eos_client,代码行数:24,


示例26: Setup

/*================idEntityFx::Event_Trigger================*/void idEntityFx::Event_Trigger( idEntity *activator ){	if( g_skipFX.GetBool() )	{		return;	}		float		fxActionDelay;	const char *fx;		if( gameLocal.time < nextTriggerTime )	{		return;	}		if( spawnArgs.GetString( "fx", "", &fx ) )	{		Setup( fx );		Start( gameLocal.time );		PostEventMS( &EV_Fx_KillFx, Duration() );		BecomeActive( TH_THINK );	}		fxActionDelay = spawnArgs.GetFloat( "fxActionDelay" );	if( fxActionDelay != 0.0f )	{		nextTriggerTime = gameLocal.time + SEC2MS( fxActionDelay );	}	else	{		// prevent multiple triggers on same frame		nextTriggerTime = gameLocal.time + 1;	}	PostEventSec( &EV_Fx_Action, fxActionDelay, activator );}
开发者ID:revelator,项目名称:MHDoom,代码行数:41,


示例27: Duration

void Placement::commit(const Placement& prevPlacement, TimePoint now) {    commitTime = now;    bool placementChanged = false;    float increment = mapMode == MapMode::Continuous ?        std::chrono::duration<float>(commitTime - prevPlacement.commitTime) / Duration(std::chrono::milliseconds(300)) :        1.0;    // add the opacities from the current placement, and copy their current values from the previous placement    for (auto& jointPlacement : placements) {        auto prevOpacity = prevPlacement.opacities.find(jointPlacement.first);        if (prevOpacity != prevPlacement.opacities.end()) {            opacities.emplace(jointPlacement.first, JointOpacityState(prevOpacity->second, increment, jointPlacement.second.text, jointPlacement.second.icon));            placementChanged = placementChanged ||                jointPlacement.second.icon != prevOpacity->second.icon.placed ||                jointPlacement.second.text != prevOpacity->second.text.placed;        } else {            opacities.emplace(jointPlacement.first, JointOpacityState(jointPlacement.second.text, jointPlacement.second.icon, jointPlacement.second.skipFade));            placementChanged = placementChanged || jointPlacement.second.icon || jointPlacement.second.text;        }    }    // copy and update values from the previous placement that aren't in the current placement but haven't finished fading    for (auto& prevOpacity : prevPlacement.opacities) {        if (opacities.find(prevOpacity.first) == opacities.end()) {            JointOpacityState jointOpacity(prevOpacity.second, increment, false, false);            if (!jointOpacity.isHidden()) {                opacities.emplace(prevOpacity.first, jointOpacity);                placementChanged = placementChanged || prevOpacity.second.icon.placed || prevOpacity.second.text.placed;            }        }    }    fadeStartTime = placementChanged ? commitTime : prevPlacement.fadeStartTime;}
开发者ID:jingsam,项目名称:mapbox-gl-native,代码行数:36,



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


C++ Dy函数代码示例
C++ DupString函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。