예제 #1
0
    inline void setAnimationTime(const TimePoint& timePoint) {
        if (mode == MapMode::Still) {
            return;
        }

        animationTime = timePoint.time_since_epoch();
    };
예제 #2
0
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
0
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
0
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
0
파일: main.cpp 프로젝트: CCJY/coliru
inline void print_ms(const TimePoint<Ms>& time_point) 
{
    std::cout << time_point.time_since_epoch().count() << " ms\n";
}
예제 #6
0
static inline double secondsSinceEpoch(TimePoint const & tp)
{
	return chrono::duration_cast<chrono::nanoseconds>(tp.time_since_epoch()).count() * 1e-9;
}