且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将 200 万行日期字符串加速转换为 POSIX.ct

更新时间:2022-11-28 14:27:37

你想要 Simon 的小而简单的 fasttime 包,它可以做到这一点以最快的方式——不调用时间解析函数,而只是使用 C 级字符串函数.

You want the small and simple fasttime package by Simon which does this in the fastest possible way---by not calling time parsing functions but just using C-level string functions.

它不支持像 strptime 那么多的格式.事实上,它甚至没有格式字符串.但是格式良好的 ISO 格式变体,即 yyyy-mm-dd hh:mm:ss.fff 将起作用,并且您的 / 分隔符也可能起作用.

It does not support as many formats as strptime. In fact, it doesn't even have a format string. But well-formed ISO format variants, that is yyyy-mm-dd hh:mm:ss.fff will work, and your / separator may just work too.