[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] No localtime_r in windows


I don't pretend it is the correct patch, but at least it fixes the compile 
time error on windows and seems to work. I'm not sure if the thread-safety 
mechanism is needed here, or if this is the proper place to define the 
function.

Alex.

$ svn diff hw/twl92230.c
Index: hw/twl92230.c
===================================================================
--- hw/twl92230.c       (revision 4215)
+++ hw/twl92230.c       (working copy)
@@ -29,6 +29,14 @@

 #define VERBOSE 1

+#ifdef _WIN32
+inline struct tm* localtime_r (const time_t *clock, struct tm *result) {
+       if (!clock || !result) return NULL;
+       memcpy(result,localtime(clock),sizeof(*result));
+       return result;
+}
+#endif
+
 struct menelaus_s {
     i2c_slave i2c;
     qemu_irq irq;








This mailing list archive is a service of Copilotco.