1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-01 03:30:20 +00:00
cc65/libsrc/c128
Oliver Schmidt 842c151edd Replaced _systime with clock_gettime.
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().
2018-08-15 16:06:44 +02:00
..
emd Replaced reu commands with defined constants. 2018-03-05 17:46:51 -08:00
joy Removed IRQ support from joystick drivers. 2018-02-01 22:38:36 +01:00
mou
ser
tgi Removed IRQ support from TGI drivers. 2018-02-02 18:15:45 +01:00
_scrsize.s
acc_c128_speed.s Merge pull request #631 from blackystardust/master 2018-04-27 20:47:03 +02:00
acc_detect_c128.s Improved the accelerator code. Fixed an infinite loop. 2018-04-26 05:46:34 -04:00
acc_detect_scpu.s Improved the accelerator code. Fixed an infinite loop. 2018-04-26 05:46:34 -04:00
acc_scpu_speed.s Merge pull request #631 from blackystardust/master 2018-04-27 20:47:03 +02:00
break.s
c64mode.s
cgetc.s Adjusted constructors. 2016-03-16 16:28:32 +01:00
clrscr.s
color.s
conio.s
cpeekc.s fix petscii conversion for C128 2017-12-11 21:53:00 +01:00
cpeekcolor.s cbm stuff from greggs pull request 2017-12-11 19:52:11 +01:00
cpeekrevers.s cbm stuff from greggs pull request 2017-12-11 19:52:11 +01:00
cpeeks.s fix cpeeks() for C128 VDC 2017-12-12 17:05:24 +01:00
cputc.s Introduced internal gotoxy that pops both parameters. 2016-06-05 14:58:38 +02:00
crt0.s Renamed RAM to MAIN for all disk based targets. 2016-03-07 01:28:55 +01:00
dbgbreak.s_
devnum.s
fast.s
get_tv.s
gettime.s Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
irq.s Renamed INITBSS to INIT and INIT to ONCE. 2016-03-06 21:27:19 +01:00
isfast.s Set X register to 0 so that 16bit promotion works as expected. 2018-03-20 14:05:55 -07:00
joy_stat_stddrv.s
joy_stddrv.s
kbhit.s
kbrepeat.s Removed dysfunctional kbrepeatdelay() and kbrepeatrate(). 2017-08-30 16:37:59 +02:00
kernal.s Moved C128 specific definitions to cbm_kernal.inc 2018-07-01 09:58:39 +03:00
libref.s
mainargs.s Renamed INITBSS to INIT and INIT to ONCE. 2016-03-06 21:27:19 +01:00
mcbdefault.s Renamed INITBSS to INIT and INIT to ONCE. 2016-03-06 21:27:19 +01:00
mouse_stat_stddrv.s
mouse_stddrv.s
mouseref.s
pencalib.c
randomize.s
revers.s
slow.s
status.s
sysuname.s
tgi_stat_stddrv.s
tgi_stddrv.s
toggle_videomode.s
videomode.s
waitvsync.s add headers/fix formatting 2017-07-18 01:04:53 +02:00