From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBKtl-0007A6-JE for qemu-devel@nongnu.org; Tue, 11 Sep 2012 03:28:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBKtk-00084T-Im for qemu-devel@nongnu.org; Tue, 11 Sep 2012 03:28:41 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:49097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBKtk-00082r-AV for qemu-devel@nongnu.org; Tue, 11 Sep 2012 03:28:40 -0400 Received: by pbbrp12 with SMTP id rp12so412673pbb.4 for ; Tue, 11 Sep 2012 00:28:39 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 11 Sep 2012 09:28:29 +0200 Message-Id: <1347348509-23900-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] win32: provide gmtime_r emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: sw@weilnetz.de Windows has _s functions from C99 instead of _r functions from POSIX. Add an emulation shim. Signed-off-by: Paolo Bonzini --- Not tested beyond compilation. os-win32.c | 12 ++++++++++++ qemu-os-win32.h | 1 + 2 file modificati, 13 inserzioni(+) diff --git a/os-win32.c b/os-win32.c index 13892ba..beeded2 100644 --- a/os-win32.c +++ b/os-win32.c @@ -55,6 +55,18 @@ int setenv(const char *name, const char *value, int overwrite) return result; } +struct tm *gmtime_r(const time_t *timep, struct tm *result) +{ + int rc; + rc = _gmtime32_s(result, timep); + if (rc == 0) { + return result; + } else { + errno = rc; + return NULL; + } +} + static BOOL WINAPI qemu_ctrl_handler(DWORD type) { qemu_system_shutdown_request(); diff --git a/qemu-os-win32.h b/qemu-os-win32.h index 753679b..284cabb 100644 --- a/qemu-os-win32.h +++ b/qemu-os-win32.h @@ -79,6 +79,7 @@ static inline void os_set_proc_name(const char *dummy) {} #endif int setenv(const char *name, const char *value, int overwrite); +struct tm *gmtime_r(const time_t *timep, struct tm *result); typedef struct { long tv_sec; -- 1.7.11.2