Are unix timestamps the best way to store timestamps?

后端 未结 9 860
梦毁少年i
梦毁少年i 2020-12-07 16:26

I always use unix timestamps for everything, but am wondering if there is a better way.

What do you use to store timestamps and why?

9条回答
  •  無奈伤痛
    2020-12-07 16:56

    timeval-style (time_t + microseconds) if I need sub-second accuracy, else just time_t. You can use a 64-bit integer value to store time_t * 1000000 + usec and you are overflow-proof for over +/- 292,000 years.

提交回复
热议问题