[clang] [clang] replaced the usage of `asctime` with `strftime` (PR #99075)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 17 07:46:51 PDT 2024
================
@@ -1722,10 +1722,12 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
// MSVC, ICC, GCC, VisualAge C++ extension. The generated string should be
// of the form "Ddd Mmm dd hh::mm::ss yyyy", which is returned by asctime.
const char *Result;
+ char TimeString[std::size("Ddd Mmm dd hh:mm:ss yyyy")];
if (getPreprocessorOpts().SourceDateEpoch) {
time_t TT = *getPreprocessorOpts().SourceDateEpoch;
std::tm *TM = std::gmtime(&TT);
----------------
AaronBallman wrote:
It's consistent with the behavior in `ComputeDATE_TIME`, perhaps because `SourceDateEpoch` is the number of seconds since the epoch and it's easier to reason about that from UTC as a base than localtime (e.g. for build reproducibility)
https://github.com/llvm/llvm-project/pull/99075
More information about the cfe-commits
mailing list