Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将我的 timeval 结构从秒转换为纳秒,实现这一目标的最佳算法是什么?
我建议这样做:
uint64_t nanosec(struct timeval t) { /* Calculate nanoseconds in a timeval structure */ return t.tv_sec * 1000000000 + t.tv_usec * 1000; }