[libcxx-commits] [PATCH] D104987: Use GetSystemTimePreciseAsFileTime() if available

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 26 08:23:35 PDT 2021


mstorsjo added a comment.

In D104987#2967130 <https://reviews.llvm.org/D104987#2967130>, @ldionne wrote:

> LGTM, but the only question I have is whether we should initialize this at file scope so as to avoid a function-local static? As it stands, we're going to be checking whether the function-local static is initialized every time we enter the function, which seems undesirable for a function like `system_clock::now()`.

Thanks, that’s a good point. Initially I was about to respond that it’s a tradeoff between startup time and runtime - but I guess libc++ has a fair number of global startup constructors anyway, so it’s probably not a big deal anyway.

However - as the initialization order of global constructors is undefined, wouldn’t it be an issue if it’s used from a constructor in user code?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104987/new/

https://reviews.llvm.org/D104987



More information about the libcxx-commits mailing list