zoukankan      html  css  js  c++  java
  • 时间boost

    #include <time.h>

    #include<sys/timeb.h>

    #ifdef WIN32

    #include<Windows.h>

    #else

    #include<stdint.h>

    #include<sys/time.h>

    #endif

    #include"boost/chrono.hpp"

    #include"boost/date_time.hpp"

    __inline int64_t getMonotonicMesc(){

      #ifdef WIN32

      uint64_t n100ns;

      QueryUnbiasedInterruptTime(&n100ns);

      return n100ns/10000;

    #else

      struct timespec ts;

      clock_gettime(CLOCK_MONOTONIC,&ts);

      return (int64_t)((int64_t)ts.tv_sec*1000+(int64_t)ts.tv_nsec/1000000);

    #endif  

    }

    __inline int64_t getUTCTimeSec()

    {

      boost::chrono::time_point<boost::chrono::system_clock,boost::chrono::seconds> curTime = boost::chrono::time_point_cast<boost::chrono::seconds>(boost::chrono::system_clock::now());

      return curTime.time_since_epoch().count();

    }

    __inline int64_t getUTCTimeMSec()

    {

      boost::chrono::time_point<boost::chrono::system_clock,boost::chrono::milliseconds> curTime = boost::chrono::time_point_cast<boost::chrono::milliseconds>(boost::chrono::system_clock::now());

      return curTime.time_since_epoch().count();

    }

    不为其他,只为快乐!
  • 相关阅读:
    poj 3096 Surprising Strings (set)
    hdu 4038 stone
    STL set 使用总结
    poj 3185 The Water Bowls (bfs 加未压缩)
    QPixmap显示图片
    addStretch的作用 .
    Qt SizeHint()
    StyleSheet
    linux编程守护进程编写
    Qt样式表的使用
  • 原文地址:https://www.cnblogs.com/1521299249study/p/14437332.html
Copyright © 2011-2022 走看看