================
@@ -10,9 +10,26 @@
 // extensions that will eventually be implemented in Fortran.
 
 #include "flang/Runtime/extensions.h"
+#include "terminator.h"
 #include "flang/Runtime/command.h"
 #include "flang/Runtime/descriptor.h"
 #include "flang/Runtime/io-api.h"
+#include "flang/Runtime/time-intrinsic.h" // copyBufferAndPad
+#include <ctime>
+
+#ifdef _WIN32
+inline void ctime_alloc(char *buffer, size_t bufsize, const time_t cur_time,
+    Fortran::runtime::Terminator terminator) {
+  int error = ctime_s(buffer, bufsize, &cur_time);
+  RUNTIME_CHECK(terminator, error == 0);
+}
+#else
+inline void ctime_alloc(char *buffer, size_t bufsize, const time_t cur_time,
+    Fortran::runtime::Terminator terminator) {
+  const char *res = ctime_r(&cur_time, buffer);
----------------
jeanPerier wrote:

Isn't some POSIX macros required here to use ctime_r?: 
https://linux.die.net/man/3/ctime_r

You can define a fallback that sets an empty string '/0'.

https://github.com/llvm/llvm-project/pull/71222
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to