How can Unix timestamps retain a logged half-second?
With subsec, unixepoch returns a number with fractional seconds so events within one second can be distinguished.
SQLite example and interpretation
An event 1.5 seconds after the epoch becomes one with integer output and 1.5 with subsec. Additional displayed digits do not improve the source clock's accuracy.
SELECT unixepoch('1970-01-01 00:00:01.500'),unixepoch('1970-01-01 00:00:01.500','subsec');Result [[1, 1.5]]
中文
秒级 Unix 输出怎样保留日志中的半秒?
unixepoch 使用 subsec 修饰符时返回含小数秒的数值,可表达秒内的事件位置。
SQLite 示例与适用条件
起点后 1.5 秒默认整数结果为 1,加 subsec 则为 1.5。展示小数不代表采集设备拥有更高精度。
SELECT unixepoch('1970-01-01 00:00:01.500'),unixepoch('1970-01-01 00:00:01.500','subsec');结果 [[1, 1.5]]