From b4b3e1d5b87c042b6edfdbab4cc6403861a703cc Mon Sep 17 00:00:00 2001 From: joerg_wunsch Date: Sun, 20 Aug 2006 06:49:11 +0000 Subject: [PATCH] * configure.ac: Check for gettimeofday(). * ppiwin.c (gettimeofday): Define gettimeofday() replacement only if !defined(HAVE_GETTIMEOFDAY); use correct protype. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@616 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 6 ++++++ configure.ac | 2 +- ppiwin.c | 11 ++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f100f324..d4b9adbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-08-20 Joerg Wunsch + + * configure.ac: Check for gettimeofday(). + * ppiwin.c (gettimeofday): Define gettimeofday() replacement + only if !defined(HAVE_GETTIMEOFDAY); use correct protype. + 2006-08-18 Joerg Wunsch * stk500v2: Minor cosmetic changes: STK500 firmware version diff --git a/configure.ac b/configure.ac index fe17d7e9..5f57d0b6 100644 --- a/configure.ac +++ b/configure.ac @@ -65,7 +65,7 @@ AC_HEADER_TIME # Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_FUNC_MALLOC -AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul]) +AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday]) # Checks for misc stuff. diff --git a/ppiwin.c b/ppiwin.c index 7e274331..f5be6517 100644 --- a/ppiwin.c +++ b/ppiwin.c @@ -1,6 +1,7 @@ /* * avrdude - A Downloader/Uploader for AVR device programmers - * Copyright (C) 2003, 2004 Eric B. Weddington + * Copyright (C) 2003, 2004, 2006 + * Eric B. Weddington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +30,7 @@ reg = register as defined in an enum in ppi.h. This must be converted */ - +#include "ac_cfg.h" #if defined (WIN32NATIVE) @@ -316,7 +317,8 @@ static void outb(unsigned char value, unsigned short port) return; } -void gettimeofday(struct timeval*tv, void*z){ +#if !defined(HAVE_GETTIMEOFDAY) +int gettimeofday(struct timeval *tv, struct timezone *unused){ // i've found only ms resolution, avrdude expects us SYSTEMTIME st; @@ -324,7 +326,10 @@ void gettimeofday(struct timeval*tv, void*z){ tv->tv_sec=(long)(st.wSecond+st.wMinute*60+st.wHour*3600); tv->tv_usec=(long)(st.wMilliseconds*1000); + + return 0; } +#endif /* HAVE_GETTIMEOFDAY */ // #define W32USLEEPDBG