本文整理汇总了C++中TimePoint::time_since_epoch方法的典型用法代码示例。如果您正苦于以下问题:C++ TimePoint::time_since_epoch方法的具体用法?C++ TimePoint::time_since_epoch怎么用?C++ TimePoint::time_since_epoch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimePoint
的用法示例。
在下文中一共展示了TimePoint::time_since_epoch方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setAnimationTime
inline void setAnimationTime(const TimePoint& timePoint) {
if (mode == MapMode::Still) {
return;
}
animationTime = timePoint.time_since_epoch();
};
示例2: OSCTime
static inline int64 OSCTime(TimePoint const & tp)
{
using namespace chrono;
typedef typename TimePoint::duration Duration;
Duration sinceEpoch = tp.time_since_epoch();
seconds secs = duration_cast<seconds>(sinceEpoch);
nanoseconds nsecs = sinceEpoch - secs;
return ((int64)(secs.count() + kSECONDS_FROM_1900_to_1970) << 32)
+ (int64)(nsecs.count() * kNanosToOSCunits);
}
示例3:
jobject mdr::JniStationPrediction::createJniStationPrediction(JNIEnv *env,
TimePoint timePoint,
float value,
std::string timeZone) {
auto duration = timePoint.time_since_epoch();
auto epoch = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
jlong jniEpoch = static_cast<jlong>(epoch);
jobject jniValue = mdr::JniFloat::toJni(env, value);
jstring tz = mdr::JniString::toJni(env, timeZone);
auto retVal = env->CallStaticObjectMethod(stationPredictionFactoryClass, factoryCtor, jniEpoch,
tz, jniValue);
mdr::Jni::checkException(env, true);
return retVal;
}
示例4: timeSeed
static inline int32 timeSeed()
{
using namespace chrono;
static int32 count = 0;
typedef high_resolution_clock::time_point TimePoint;
typedef TimePoint::duration Duration;
TimePoint now = high_resolution_clock::now();
Duration sinceEpoch = now.time_since_epoch();
seconds secs = duration_cast<seconds>(sinceEpoch);
nanoseconds nsecs = sinceEpoch - secs;
return (int32)secs.count() ^ (int32)nsecs.count() ^ count--;
}
示例5: print_ms
inline void print_ms(const TimePoint<Ms>& time_point)
{
std::cout << time_point.time_since_epoch().count() << " ms\n";
}
示例6: secondsSinceEpoch
static inline double secondsSinceEpoch(TimePoint const & tp)
{
return chrono::duration_cast<chrono::nanoseconds>(tp.time_since_epoch()).count() * 1e-9;
}