/*
**
** $VER: amiga_specific.h 0.2 (03.10.02)
** Description
**
** (C) Copyright 2002 Alexandre Balaban
**
** $HISTORY :
**		- 0.2, 03.10.02 : Included PPC compilation improvements by Steffen Haeuser
**		- 0.1, 27.07.02 : Original version
**
*/

#ifndef _AMIGA_SPECIFIC_H_
#define _AMIGA_SPECIFIC_H_

#ifdef AMIGA
#ifdef __cplusplus
extern "C" {
#endif
#include <dos/dos.h>
#include <devices/timer.h>
#include <dos/datetime.h>
#ifndef __PPC__
extern struct DateStamp * DateStamp( struct DateStamp *);
#endif // !__PPC__
#ifdef __cplusplus
}
#endif

#ifndef __PPC__
struct myTimeval {
    long    tv_sec;        /* seconds */
    long    tv_usec;    /* and microseconds */
};

static int gettimeofday( struct myTimeval * tval, struct timezone * tz )
{
	struct DateStamp stDs,*stDs2;
	
	stDs2 = DateStamp( &stDs );
	tval->tv_usec = stDs.ds_Tick % TICKS_PER_SECOND;
	tval->tv_sec = stDs.ds_Minute * 60 + stDs.ds_Tick / TICKS_PER_SECOND;
	
	return 0;
}
#else
struct timeval;
#define myTimeval timeval
#endif // !__PPC__
#else
struct timeval;
#define myTimeval timeval
#endif // AMIGA

#endif /* AMIGA_SPECIFIC */
