Fixed missing headers + RTC bug

This commit is contained in:
llsth 2015-03-18 00:53:36 +01:00
parent 2e2438f8ca
commit 23dc34c1cf
2 changed files with 12 additions and 2 deletions

View File

@ -36,6 +36,10 @@
#include <math.h>
#include <sys/socket.h>
#include <resources/battclock.h>
#include <clib/battclock_protos.h>
#include <clib/utility_protos.h>
#ifdef Debug
#undef Debug
#endif

View File

@ -257,6 +257,7 @@ void delete_timer(struct timerequest *request)
int amiga_get_time(struct timeval *tv)
{
struct timerequest *request;
long tzoffset = (long)round(utcoffset * 60.0 * 60.0);
request = create_timer();
if (request == NULL)
@ -266,6 +267,7 @@ int amiga_get_time(struct timeval *tv)
DoIO((struct IORequest*)request);
*tv = request->tr_time;
tv->tv_secs = (long)tv->tv_secs - tzoffset;
delete_timer(request);
return 0;
@ -295,13 +297,17 @@ int amiga_set_time(struct timeval *tv)
void amiga_save_time(void)
{
struct timeval tv;
long tzoffset;
if(!validtime)
return;
struct timeval tv;
ResetBattClock();
amiga_get_time(&tv);
WriteBattClock(tv.tv_secs);
tzoffset = (long)round(utcoffset * 60.0 * 60.0);
WriteBattClock((long)tv.tv_secs + tzoffset);
}
void amiga_sync_time(int seconds)