1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 19:29:37 +00:00
cc65/libsrc/plus4
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
..
joy Removed IRQ support from joystick drivers. 2018-02-01 22:38:36 +01:00
ser Create static drivers directly from source files. 2014-06-04 23:50:18 +02:00
_scrsize.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
break.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
cgetc.s Save the three bytes for the plus4 too. 2018-05-27 00:10:58 +02:00
clrscr.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
color.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
conio.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02: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
devnum.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
fast.s Added c16/plus4 fast(), isfast() and slow() functions, and updated the documentation accordingly. 2018-03-23 14:27:15 -07:00
get_tv.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
irq.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
isfast.s Added c16/plus4 fast(), isfast() and slow() functions, and updated the documentation accordingly. 2018-03-23 14:27:15 -07:00
joy_stat_stddrv.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
joy_stddrv.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
kacptr.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kbasin.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kbhit.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
kbrepeat.s Removed dysfunctional kbrepeatdelay() and kbrepeatrate(). 2017-08-30 16:37:59 +02:00
kbsout.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kchkin.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kciout.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kckout.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kclall.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kclose.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
kclrch.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kiobase.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
klisten.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kload.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kopen.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kplot.s More banking support 2002-11-22 22:24:24 +00:00
krdtim.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kreadst.s Need to import ST since it is no longer declared in plus4.inc. 2012-10-02 19:22:19 +00:00
ksave.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kscnkey.s Added C-code interfaces for the CBM Kernal functions SCNKEY and UDTIM. 2016-08-07 15:50:10 -04:00
ksetlfs.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
ksetnam.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
ksettim.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
ktalk.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kudtim.s Added C-code interfaces for the CBM Kernal functions SCNKEY and UDTIM. 2016-08-07 15:50:10 -04:00
kunlsn.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
kuntlk.s Added wrappers for the kernal functions 2002-11-22 22:16:20 +00:00
libref.s Added library reference ser_libref to SER interface. 2013-06-01 11:03:14 +02:00
mainargs.s Renamed INITBSS to INIT and INIT to ONCE. 2016-03-06 21:27:19 +01:00
randomize.s Fixed the random-seed generators for the Commodore targets. 2015-09-11 10:03:07 -04:00
revers.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
slow.s Added c16/plus4 fast(), isfast() and slow() functions, and updated the documentation accordingly. 2018-03-23 14:27:15 -07:00
status.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
sysuname.s New uname function 2003-08-12 17:24:02 +00:00
waitvsync.s add headers/fix formatting 2017-07-18 01:04:53 +02:00