1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-06 01:29:31 +00:00
cc65/libsrc/atmos
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
tgi Removed IRQ support from TGI drivers. 2018-02-02 18:15:45 +01:00
_scrsize.s Replaced number literals in source code with meaningful symbol names. 2013-07-26 03:33:54 -04:00
atmos_load.s Replaced number literals in source code with meaningful symbol names. 2013-07-26 03:33:54 -04:00
atmos_save.s Replaced number literals in source code with meaningful symbol names. 2013-07-26 03:33:54 -04:00
atmos.s oops 2017-12-17 18:45:57 +01:00
bashdr.s Converted the Atmos configuration to the new constructor segment model. 2016-03-18 11:28:56 -04:00
capslock.s Converted the Atmos configuration to the new constructor segment model. 2016-03-18 11:28:56 -04:00
cclear.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
cgetc.s Moved initcgetc to initcputc 2018-01-23 13:02:47 +01:00
chline.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
clock.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
clrscr.s Replaced number literals in source code with meaningful symbol names. 2013-07-26 03:33:54 -04:00
color.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
cputc.s Moved initcgetc to initcputc 2018-01-23 13:02:47 +01:00
crt0.s Converted the Atmos configuration to the new constructor segment model. 2016-03-18 11:28:56 -04:00
ctype.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
cvline.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
gotox.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
gotoxy.s Added a missing label to some conio cursor movement functions. 2017-06-15 16:44:46 -04:00
gotoy.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
irq.s Renamed INITBSS to INIT and INIT to ONCE. 2016-03-06 21:27:19 +01: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
kbhit.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
libref.s Added library reference tgi_libref to TGI interface. 2013-06-01 12:42:00 +02:00
mainargs.s Converted the Atmos configuration to the new constructor segment model. 2016-03-18 11:28:56 -04:00
oserrlist.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
oserror.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
read.s Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
revers.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
store_filename.s Replaced number literals in source code with meaningful symbol names. 2013-07-26 03:33:54 -04:00
sysuname.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
tapehdr.s Converted the Atmos configuration to the new constructor segment model. 2016-03-18 11:28:56 -04:00
tgi_stat_stddrv.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
tgi_stddrv.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
wherex.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
wherey.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
write.s Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00