美文网首页
时间单位

时间单位

作者: VinZZZZ | 来源:发表于2021-07-01 14:04 被阅读0次
    dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, 3 * NSEC_PER_SEC);
    // Nanoseconds to add
    

    表示3秒 (3 * NSEC_PER_SEC 纳秒)。

    SEC (second) 秒 s
    MSEC (millisecond) 毫秒 ms
    USEC (microsecond) 微秒 µs (us)
    NSEC (nanoseconds) 纳秒 ns
    1s = 10^3 ms = 10^6 µs = 10^9 ns

    #define NSEC_PER_SEC 1000000000ull     每秒多少纳秒            1秒 = 10^9纳秒              
    #define USEC_PER_SEC 1000000ull            每秒多少微秒             1秒 = 10^6 微秒   
    #define NSEC_PER_USEC 1000ull                 每微秒多少纳秒        1微秒 = 10^3 纳秒
    #define NSEC_PER_MSEC 1000000ull         每毫秒多少纳秒        1毫秒 = 10^6纳秒
    

    其中 ull 是C语言的数值字面量,是显式表明类型时使用的字符串(表示 ”unsigned long long “)

    https://zh.wikipedia.org/wiki/数量级_(时间)

    相关文章

      网友评论

          本文标题:时间单位

          本文链接:https://www.haomeiwen.com/subject/mmpjultx.html