* 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
This commit is contained in:
Joerg Wunsch 2006-08-20 06:49:11 +00:00
parent 7846e5b1fa
commit 80194a06f6
3 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2006-08-20 Joerg Wunsch <j@uriah.heep.sax.de>
* configure.ac: Check for gettimeofday().
* ppiwin.c (gettimeofday): Define gettimeofday() replacement
only if !defined(HAVE_GETTIMEOFDAY); use correct protype.
2006-08-18 Joerg Wunsch <j@uriah.heep.sax.de>
* stk500v2: Minor cosmetic changes: STK500 firmware version

View File

@ -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.

View File

@ -1,6 +1,7 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2003, 2004 Eric B. Weddington <ericw@evcohs.com>
* Copyright (C) 2003, 2004, 2006
* Eric B. Weddington <eweddington@cso.atmel.com>
*
* 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