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


C++ time_duration::total_microseconds方法代码示例

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


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

示例1: max

 Typesystem::Int64 MonotonicClock::Get(const Typesystem::Int64 oldTime)
 {
     using namespace boost::posix_time;
     const ptime now = microsec_clock::universal_time();
     const time_duration diff = now - epoch;
     const Typesystem::Int64 newTime = diff.total_microseconds();
     return std::max(newTime,oldTime+1);
 }
开发者ID:SafirSDK,项目名称:safir-sdk-core,代码行数:8,代码来源:MonotonicClock.cpp

示例2: secondsFromDuration

/**
 * Return the number of seconds in a time_duration, as a double, including
 * fractional seconds.
 */
double DateAndTime::secondsFromDuration(time_duration duration) {
#ifdef BOOST_DATE_TIME_HAS_NANOSECONDS
  // Nanosecond resolution
  return static_cast<double>(duration.total_nanoseconds()) / 1e9;
#else
  // Microsecond resolution
  return static_cast<double>(duration.total_microseconds()) / 1e6;
#endif
}
开发者ID:rosswhitfield,项目名称:mantid,代码行数:13,代码来源:DateAndTime.cpp

示例3: epoch

 RandomGenerator()
 {
     using namespace boost::posix_time;
     const ptime epoch(boost::gregorian::date(2008,1,1));
     const ptime now = microsec_clock::universal_time();
     const time_duration diff = now - epoch;
     const boost::uint32_t my_seed = 
         (static_cast<boost::uint32_t>(diff.total_microseconds()) * Safir::Utilities::ProcessInfo::GetPid()) 
         % std::numeric_limits<boost::uint32_t>::max();
     m_randomGenerator.seed(my_seed);
 }
开发者ID:SafirSDK,项目名称:safir-sdk-core,代码行数:11,代码来源:lluf_id.cpp

示例4: microseconds

TSVolatility::TSVolatility( Prices& series, time_duration dtTau, time_duration dtTauPrime, double p, unsigned int n ) 
  : m_seriesSource( series ), 
    m_dtTau( dtTau ), 
    m_dtTauByTwo( microseconds( dtTau.total_microseconds() / 2 ) ),
//    m_dtTauPrime( microseconds( dtTauPrime.total_microseconds() / 2 ) ), 
    m_dtTauPrime( dtTauPrime ),
    m_p( p ), 
    m_n( n ),
    m_tsDif( series, dtTauPrime ), 
    m_tsNorm( m_tsDif, m_dtTauByTwo, n, p )
{
}
开发者ID:rburkholder,项目名称:trade-frame,代码行数:12,代码来源:TSVolatility.cpp

示例5: nanosecondsFromDuration

/** time duration in nanoseconds. Duration is limited to
 * MAX_NANOSECONDS and MIN_NANOSECONDS to avoid overflows.
 * @param td :: time_duration instance.
 * @return an int64 of the number of nanoseconds
 */
int64_t DateAndTime::nanosecondsFromDuration(const time_duration &td) {
  int64_t nano;
#ifdef BOOST_DATE_TIME_HAS_NANOSECONDS
  // Nanosecond resolution
  nano = td.total_nanoseconds();
#else
  // Microsecond resolution
  nano = (td.total_microseconds() * 1000);
#endif
  // Use these limits to avoid integer overflows
  if (nano > MAX_NANOSECONDS)
    return MAX_NANOSECONDS;
  else if (nano < MIN_NANOSECONDS)
    return MIN_NANOSECONDS;
  else
    return nano;
}
开发者ID:rosswhitfield,项目名称:mantid,代码行数:22,代码来源:DateAndTime.cpp


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