diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2021-07-07 15:02:52 +0100 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2021-07-07 15:02:52 +0100 |
commit | a7e976b3fbc1038408b024b46dced0205514e109 (patch) | |
tree | 786d40adea78bd4318b5fd1aa6708c53e2a60619 | |
parent | cdf821454ae0328224c037398ac2f41ab4acd163 (diff) | |
download | netsurf-a7e976b3fbc1038408b024b46dced0205514e109.tar.gz netsurf-a7e976b3fbc1038408b024b46dced0205514e109.tar.bz2 |
Amiga: switch to using OS3.2's idea of TimeVal/TimeRequest
-rw-r--r-- | frontends/amiga/font_cache.c | 4 | ||||
-rw-r--r-- | frontends/amiga/os3support.h | 16 | ||||
-rw-r--r-- | frontends/amiga/schedule.c | 24 |
3 files changed, 22 insertions, 22 deletions
diff --git a/frontends/amiga/font_cache.c b/frontends/amiga/font_cache.c index b8039d22c..cdb26fe00 100644 --- a/frontends/amiga/font_cache.c +++ b/frontends/amiga/font_cache.c @@ -101,12 +101,12 @@ static void ami_font_cache_cleanup(struct MinList *ami_font_cache_list) fnode = node->objstruct; GetSysTime((struct timeval *)&curtime); SubTime((struct timeval *)&curtime, (struct timeval *)&fnode->lastused); - if(curtime.Seconds > 300) + if(curtime.tv_secs > 300) { NSLOG(netsurf, INFO, "Freeing %s not used for %d seconds", node->dtz_Node.ln_Name, - curtime.Seconds); + curtime.tv_secs); DelObject(node); } } while((node=nnode)); diff --git a/frontends/amiga/os3support.h b/frontends/amiga/os3support.h index f04b37b77..2df014117 100644 --- a/frontends/amiga/os3support.h +++ b/frontends/amiga/os3support.h @@ -120,12 +120,6 @@ /* Renamed structures */ #define AnchorPathOld AnchorPath -/* TimeVal/TimeRequest */ -#define Seconds tv_secs -#define Microseconds tv_micro -#define Request tr_node -#define Time tr_time - /* ReAction (ClassAct) macros */ #define GetFileEnd End #define GetFontEnd End @@ -220,6 +214,12 @@ int alphasort(const struct dirent **d1, const struct dirent **d2); int scandir(const char *dir, struct dirent ***namelist, int (*filter)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)); -#endif -#endif +#else /* __amigaos4__ */ +/* TimeVal/TimeRequest */ +#define tv_secs Seconds +#define tv_micro Microseconds +#define tr_node Request +#define tr_time Time +#endif /* __amigaos4__ */ +#endif /* AMIGA_OS3SUPPRT_H_ */ diff --git a/frontends/amiga/schedule.c b/frontends/amiga/schedule.c index 307fff3e9..18eb1af61 100644 --- a/frontends/amiga/schedule.c +++ b/frontends/amiga/schedule.c @@ -83,15 +83,15 @@ static nserror ami_schedule_add_timer_event(struct nscallback *nscb, int t) struct TimeVal tv; ULONG time_us = t * 1000; /* t converted to µs */ - tv.Seconds = time_us / 1000000; - tv.Microseconds = time_us % 1000000; + tv.tv_secs = time_us / 1000000; + tv.tv_micro = time_us % 1000000; GetSysTime(&nscb->tv); AddTime(&nscb->tv, &tv); // now contains time when event occurs (for debug and heap sorting) - nscb->timereq.Request.io_Command = TR_ADDREQUEST; - nscb->timereq.Time.Seconds = tv.Seconds; // secs - nscb->timereq.Time.Microseconds = tv.Microseconds; // micro + nscb->timereq.tr_node.io_Command = TR_ADDREQUEST; + nscb->timereq.tr_time.tv_secs = tv.tv_secs; // secs + nscb->timereq.tr_time.tv_micro = tv.tv_micro; // micro SendIO((struct IORequest *)nscb); return NSERROR_OK; @@ -219,27 +219,27 @@ static void ami_schedule_dump(void) PblIterator *iterator; struct nscallback *nscb; struct ClockData clockdata; - + if(pblHeapIsEmpty(schedule_list)) return; struct TimeVal tv; GetSysTime(&tv); - Amiga2Date(tv.Seconds, &clockdata); - + Amiga2Date(tv.tv_secs, &clockdata); + NSLOG(netsurf, INFO, "Current time = %d-%d-%d %d:%d:%d.%lu", clockdata.mday, clockdata.month, clockdata.year, - clockdata.hour, clockdata.min, clockdata.sec, tv.Microseconds); + clockdata.hour, clockdata.min, clockdata.sec, tv.tv_micro); NSLOG(netsurf, INFO, "Events remaining in queue:"); iterator = pblHeapIterator(schedule_list); while ((nscb = pblIteratorNext(iterator)) != (void *)-1) { - Amiga2Date(nscb->tv.Seconds, &clockdata); + Amiga2Date(nscb->tv.tv_secs, &clockdata); NSLOG(netsurf, INFO, "nscb: %p, at %d-%d-%d %d:%d:%d.%lu, callback: %p, %p", nscb, clockdata.mday, clockdata.month, clockdata.year, clockdata.hour, clockdata.min, clockdata.sec, - nscb->tv.Microseconds, nscb->callback, nscb->p); + nscb->tv.tv_micro, nscb->callback, nscb->p); if(CheckIO((struct IORequest *)nscb) == NULL) { NSLOG(netsurf, INFO, "-> ACTIVE"); } else { @@ -283,7 +283,7 @@ static void ami_schedule_open_timer(struct MsgPort *msgport) OpenDevice("timer.device", UNIT_VBLANK, (struct IORequest *)tioreq, 0); - TimerBase = (struct Device *)tioreq->timereq.Request.io_Device; + TimerBase = (struct Device *)tioreq->timereq.tr_node.io_Device; #ifdef __amigaos4__ ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase, "main", 1, NULL); #endif |