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


C++ TimePoint::time_since_epoch方法代码示例

本文整理汇总了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();
    };
开发者ID:nagyistoce,项目名称:mapbox-gl-native,代码行数:7,代码来源:map_data.hpp

示例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);
}
开发者ID:DSastre,项目名称:supercollider,代码行数:12,代码来源:SC_Time.hpp

示例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;
}
开发者ID:manimaul,项目名称:AndXtideLib,代码行数:14,代码来源:JniStationPrediction.cpp

示例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--;
}
开发者ID:DSastre,项目名称:supercollider,代码行数:17,代码来源:SC_Time.hpp

示例5: print_ms

inline void print_ms(const TimePoint<Ms>& time_point) 
{
    std::cout << time_point.time_since_epoch().count() << " ms\n";
}
开发者ID:CCJY,项目名称:coliru,代码行数:4,代码来源:main.cpp

示例6: secondsSinceEpoch

static inline double secondsSinceEpoch(TimePoint const & tp)
{
	return chrono::duration_cast<chrono::nanoseconds>(tp.time_since_epoch()).count() * 1e-9;
}
开发者ID:DSastre,项目名称:supercollider,代码行数:4,代码来源:SC_Time.hpp


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