We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
写普通文件就不需要TSCNS了. 前端延迟只需要1cycle, 我都惊呆了!
ps: TSCNS应该提炼出来, 再完善一下, 和fmt结合, 提供时间日期格式化功能.
The text was updated successfully, but these errors were encountered:
TSCNS本来就是一个独立的项目:https://github.com/MengRao/tscns 另外用fmt格式化ns可以自己实现:
static const int64_t SEC = 1000000000; extern int64_t tzoffset_ns; struct FmtNs { FmtNs(int64_t ns_) : ns(ns_) {} int64_t ns; }; template<> struct fmt::formatter<FmtNs> : fmt::formatter<std::string_view> { template<typename FormatContext> auto format(FmtNs ts, FormatContext& ctx) { uint64_t t = ts.ns + tzoffset_ns; Str<18> str; ((Str<9>*)&str[9])->fromi(t % SEC); // ns t /= SEC; str[8] = '.'; ((Str<2>*)&str[6])->fromi(t % 60); // sec t /= 60; str[5] = ':'; ((Str<2>*)&str[3])->fromi(t % 60); // min t /= 60; str[2] = ':'; ((Str<2>*)&str[0])->fromi(t % 24); // hour return format_to(ctx.out(), "{}", str.tosv()); } };
int64_t ns = tscns.rdns(); fmt::print("ns: {}", FmtNs(ns));
Sorry, something went wrong.
No branches or pull requests
写普通文件就不需要TSCNS了.
前端延迟只需要1cycle, 我都惊呆了!
ps: TSCNS应该提炼出来, 再完善一下, 和fmt结合, 提供时间日期格式化功能.
The text was updated successfully, but these errors were encountered: