From 992f897440702639115128a08ceaf893df1316ac Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Sat, 25 Dec 2010 22:17:02 +0000 Subject: [PATCH] Make sim build compilable under Cygwin. Fixes FS#11832. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28899 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/common/io.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 56abf4b6ad..f77180dc21 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c @@ -309,6 +309,14 @@ MYDIR *sim_opendir(const char *name) return (MYDIR *)0; } +#if defined(WIN32) +static 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 sim_dirent *sim_readdir(MYDIR *dir) { char buffer[MAX_PATH]; /* sufficiently big */ @@ -346,7 +354,7 @@ struct sim_dirent *sim_readdir(MYDIR *dir) (tm.tm_min << 5) | (tm.tm_sec >> 1); -#ifdef HAVE_LSTAT +#if HAVE_LSTAT #define ATTR_LINK 0x80 if (!lstat(buffer, &s) && S_ISLNK(s.st_mode)) {