================ @@ -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); - Result = asctime(TM); + strftime(TimeString, std::size(TimeString), "%c", TM); ---------------- yichi170 wrote:
I see. Do you mean if the result of `strftime` is zero, `Result` have to be set as "???...?"? https://github.com/llvm/llvm-project/pull/99075 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits