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


C++ TimeSpan::getSeconds方法代码示例

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


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

示例1: fromTimeSpan

 inline SampleRate fromTimeSpan(const TimeSpan& timeSpan)
 {
     if(timeSpan > TimeSpan::Seconds(1))
     {
         return SampleRate::Seconds(
             static_cast<uint32>(timeSpan.getSeconds()));
     }
     else
     {
         uint32 samplesPerSecond = static_cast<uint32>(
             TimeSpan::NANOSECONDS_PER_SECOND /
             timeSpan.getNanoseconds());
         return SampleRate::Hertz(samplesPerSecond);
     }
 }
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:15,代码来源:SampleRate.cpp

示例2: write_samplingDelay

	void NodeEepromHelper::write_samplingDelay(TimeSpan delay)
	{
		uint64 valueToWrite = 0;

		//get the type of node
		WirelessModels::NodeModel nodeType = m_node->model();

		switch(nodeType)
		{
			//these nodes all store the sampling delay in microseconds
			case WirelessModels::node_shmLink:
			case WirelessModels::node_shmLink2:
			case WirelessModels::node_sgLink_herm:
			case WirelessModels::node_sgLink_herm_2600:
			case WirelessModels::node_sgLink_herm_2700:
			case WirelessModels::node_sgLink_herm_2800:
			case WirelessModels::node_sgLink_rgd:
				valueToWrite = delay.getMicroseconds();
				break;

			default:
				break;
		}

		//if the delay is 1 second or more
		if(delay >= TimeSpan::Seconds(1))
		{
			//the delay should be stored as seconds
			valueToWrite = delay.getSeconds();
			valueToWrite += 32768;	//set the most significant bit on
		}
		else
		{
			//the delay should be stored as milliseconds
			valueToWrite = delay.getMilliseconds();
		}

		write(NodeEepromMap::SAMPLING_DELAY, Value::UINT16(static_cast<uint16>(valueToWrite)));
	}
开发者ID:estump,项目名称:MSCL,代码行数:39,代码来源:NodeEepromHelper.cpp

示例3: write_timeBetweenBursts

	void NodeEepromHelper::write_timeBetweenBursts(const TimeSpan& timespan)
	{
		//get the time in seconds from the TimeSpan
		uint64 timeInSeconds = timespan.getSeconds();

		//0 = seconds, 1 = minutes
		uint16 timeResolution = 0;

		//if the total seconds in the timespan is more than we can set when using "seconds"
		if(timeInSeconds > TIME_BETWEEN_BURSTS_MAX_SECS)
		{
			//convert from seconds to minutes (rounding up)
			timeInSeconds = static_cast<uint16>(std::ceil(static_cast<float>(timeInSeconds / 60.0f)));

			//set the resolution to minutes
			timeResolution = 1;
		}

		//build the value to write from the resolution bit and the time in seconds
		uint16 valToWrite = (timeResolution << 15) + static_cast<uint16>(timeInSeconds);

		//write the value we calculated
		write(NodeEepromMap::TIME_BETW_SESSIONS, Value::UINT16(valToWrite));
	}
开发者ID:estump,项目名称:MSCL,代码行数:24,代码来源:NodeEepromHelper.cpp


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