1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00
cc65/libsrc/c64
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 Make NMI ready 2018-05-14 23:22:09 +00:00
extra added peek functions for soft80 2017-12-28 01:58:03 +01:00
joy tweak driver to no more use IRQ 2018-03-07 00:20:42 +01:00
mou Changed literal zeroes of the style "#>0" into the style "#>$0000". 2014-09-10 19:15:07 -04:00
ser Create static drivers directly from source files. 2014-06-04 23:50:18 +02:00
tgi Merge pull request #687 from polluks/patch-12 2018-06-21 22:37:29 +02:00
_scrsize.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
acc_c64dtv_speed.s Merge pull request #631 from blackystardust/master 2018-04-27 20:47:03 +02:00
acc_c65_speed.s Removed obsolete bit opcode. 2018-04-29 12:13:52 -07:00
acc_c128_speed.s Improved the accelerator code. Fixed an infinite loop. 2018-04-26 05:46:34 -04:00
acc_chameleon_speed.s Removed extern keyword from function prototypes. 2018-04-27 09:16:25 -07:00
acc_detect_c64dtv.s Improved the accelerator code. Fixed an infinite loop. 2018-04-26 05:46:34 -04:00
acc_detect_c65.s Fixed a wrong branch. 2018-04-28 13:26:20 -07:00
acc_detect_c128.s Improved the accelerator code. Fixed an infinite loop. 2018-04-26 05:46:34 -04:00
acc_detect_chameleon.s Optimized the code a bit as suggested by Greg. 2018-04-26 09:18:54 -07:00
acc_detect_scpu.s Added C64/C128 SuperCPU accelerator functions and started on a generic framework for accelerators. 2018-04-09 19:36:53 -07:00
acc_detect_turbomaster.s Harmonized the comments (as in added 1 space) ;) 2018-05-03 09:11:20 -07:00
acc_scpu_speed.s Removed extern keyword from function prototypes. 2018-04-27 09:16:25 -07:00
acc_turbomaster_speed.s Optimized the code a bit, thanks to Greg for the suggestions/comments. 2018-05-01 14:46:57 -07:00
bordercolor.s split regular color.s into color.s and bordercolor.s 2015-10-14 17:25:35 +02:00
break.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
cgetc.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
clrscr.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
color.s remove deleted function from comment 2015-10-14 17:52:14 +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 Cleaned up C64 linker configs. 2016-03-13 14:32:07 +01:00
devnum.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
get_ostype.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
get_tv.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
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
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
kbrepeat.s Removed dysfunctional kbrepeatdelay() and kbrepeatrate(). 2017-08-30 16:37:59 +02:00
kernal.s TAB to space conversion 2018-06-30 16:25:43 +03:00
kplot.s Changed the solution for the PLOT problem with old -02 kernals to that used 2009-09-27 18:45:08 +00:00
libref.s Cleaned 2 source files by removing commented-out lines that are active in other files. 2013-08-23 07:36:11 -04:00
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
mcbspritedata.s Allow to override mouse sprite location data. 2015-10-12 20:18:13 +02:00
mouse_stat_stddrv.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
mouse_stddrv.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
mouseref.s Fixed some line endings. 2013-07-25 13:53:15 -04:00
pencalib.c Fixed some line endings. 2013-07-25 13:53:15 -04: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
soft80_cgetc.s updated comments 2015-10-19 02:47:40 +02:00
soft80_charset.s Renamed INITBSS to INIT and INIT to ONCE. 2016-03-06 21:27:19 +01:00
soft80_color.s updated comments 2015-10-19 02:47:40 +02:00
soft80_conio.s Renamed INITBSS to INIT and INIT to ONCE. 2016-03-06 21:27:19 +01:00
soft80_cpeekc.s convert to petscii 2017-12-28 17:52:27 +01:00
soft80_cpeekcolor.s added peek functions for soft80 2017-12-28 01:58:03 +01:00
soft80_cpeekrevers.s some cleanup 2017-12-28 02:26:23 +01:00
soft80_cpeeks.s added peek functions for soft80 2017-12-28 01:58:03 +01:00
soft80_cputc.s Introduced internal gotoxy that pops both parameters. 2016-06-05 14:58:38 +02:00
soft80_kclrscr.s use 'soft80_internal_cellcolor' for the current cell color, and CHARCOLOR for the actual textcolor 2015-10-14 17:24:16 +02:00
soft80_kplot.s move some stuff to init segment, saves roughly 1480 bytes :) 2015-10-12 23:39:47 +02:00
soft80_scrsize.s maintain lsb of cursor x position internally, saves some bytes and some cycles too :) 2015-10-12 15:44:41 +02:00
soft80.inc move some stuff to init segment, saves roughly 1480 bytes :) 2015-10-12 23:39:47 +02:00
soft80mono_cgetc.s added size optimized monochrom soft80 driver 2015-10-19 02:49:32 +02:00
soft80mono_color.s added size optimized monochrom soft80 driver 2015-10-19 02:49:32 +02:00
soft80mono_conio.s Renamed INITBSS to INIT and INIT to ONCE. 2016-03-06 21:27:19 +01:00
soft80mono_cpeekcolor.s added peek functions for soft80 2017-12-28 01:58:03 +01:00
soft80mono_cputc.s Introduced internal gotoxy that pops both parameters. 2016-06-05 14:58:38 +02:00
soft80mono_kclrscr.s added size optimized monochrom soft80 driver 2015-10-19 02:49:32 +02:00
soft80mono_kplot.s added size optimized monochrom soft80 driver 2015-10-19 02:49:32 +02: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
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
waitvsync.s add headers/fix formatting 2017-07-18 01:04:53 +02:00