mirror of
https://github.com/cc65/cc65.git
synced 2024-11-19 06:31:31 +00:00
842c151edd
We want to add the capability to not only get the time but also set the time, but there's no "setter" for the "getter" time(). The first ones that come into mind are gettimeofday() and settimeofday(). However, they take a struct timezone argument that doesn't make sense - even the man pages says "The use of the timezone structure is obsolete; the tz argument should normally be specified as NULL." And POSIX says "Applications should use the clock_gettime() function instead of the obsolescent gettimeofday() function." The ...timeofday() functions work with microseconds while the clock_...time() functions work with nanoseconds. Given that we expect our targets to support only 1/10 of seconds the microseconds look preferable at first sight. However, already microseconds require the cc65 data type 'long' so it's not such a relevant difference to nanoseconds. Additionally clock_getres() seems useful. In order to avoid code duplication clock_gettime() takes over the role of the actual time getter from _systime(). So time() now calls clock_gettime() instead of _systime(). For some reason beyond my understanding _systime() was mentioned in time.h. _systime() worked exactly like e.g. _sysremove() and those _sys...() functions are all considered internal. The only reason I could see would be a performance gain of bypassing the time() wrapper. However, all known _systime() implementations internally called mktime(). And mktime() is implemented in C using an iterative algorithm so I really can't see what would be left to gain here. From that perspective I decided to just remove _systime(). |
||
---|---|---|
.. | ||
joy | ||
ser | ||
_scrsize.s | ||
break.s | ||
cgetc.s | ||
clrscr.s | ||
color.s | ||
conio.s | ||
cputc.s | ||
crt0.s | ||
devnum.s | ||
fast.s | ||
get_tv.s | ||
irq.s | ||
isfast.s | ||
joy_stat_stddrv.s | ||
joy_stddrv.s | ||
kacptr.s | ||
kbasin.s | ||
kbhit.s | ||
kbrepeat.s | ||
kbsout.s | ||
kchkin.s | ||
kciout.s | ||
kckout.s | ||
kclall.s | ||
kclose.s | ||
kclrch.s | ||
kiobase.s | ||
klisten.s | ||
kload.s | ||
kopen.s | ||
kplot.s | ||
krdtim.s | ||
kreadst.s | ||
ksave.s | ||
kscnkey.s | ||
ksetlfs.s | ||
ksetnam.s | ||
ksettim.s | ||
ktalk.s | ||
kudtim.s | ||
kunlsn.s | ||
kuntlk.s | ||
libref.s | ||
mainargs.s | ||
randomize.s | ||
revers.s | ||
slow.s | ||
status.s | ||
sysuname.s | ||
waitvsync.s |