1
0
mirror of https://github.com/cc65/cc65.git synced 2024-09-29 02:55:20 +00:00
cc65/doc
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
..
apple2.sgml Switched Apple II output format to AppleSingle. 2018-03-07 23:05:21 +01:00
apple2enh.sgml Switched Apple II output format to AppleSingle. 2018-03-07 23:05:21 +01:00
ar65.sgml
atari2600.sgml
atari5200.sgml
atari.sgml
atmos.sgml
c16.sgml Add CBM kernal call SECOND to CBM library (see issue #525) 2018-05-23 17:32:02 +02:00
c64.sgml Add CBM kernal call SECOND to CBM library (see issue #525) 2018-05-23 17:32:02 +02:00
c128.sgml Add CBM kernal call SECOND to CBM library (see issue #525) 2018-05-23 17:32:02 +02:00
ca65.sgml
cbm510.sgml Add CBM kernal call SECOND to CBM library (see issue #525) 2018-05-23 17:32:02 +02:00
cbm610.sgml Add CBM kernal call SECOND to CBM library (see issue #525) 2018-05-23 17:32:02 +02:00
cc65-intern.sgml
cc65.sgml
chrcvt65.sgml
cl65.sgml
co65.sgml
coding.sgml
creativision.sgml Creativision documentation enhancements. 2017-11-15 00:13:06 +01:00
customizing.sgml
da65.sgml Followed the discussions in the Pull request #682. 2018-06-14 02:02:16 +09:00
debugging.sgml Fixed the SGML <htmlurl> and <url> tags. 2014-04-14 05:54:13 -04:00
dio.sgml
doc.css
doc.png
funcref.sgml Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
gamate.sgml
geos.sgml
grc65.sgml
header.html
index.sgml
intro.sgml Switched Apple II output format to AppleSingle. 2018-03-07 23:05:21 +01:00
ld65.sgml
library.sgml
lynx.sgml
Makefile
nes.sgml
od65.sgml
osi.sgml
pce.sgml
pet.sgml cbm_k_tksa() from the PET docs 2018-05-22 18:48:43 +02:00
plus4.sgml Add CBM kernal call SECOND to CBM library (see issue #525) 2018-05-23 17:32:02 +02:00
sim65.sgml
smc.sgml
sp65.sgml
supervision.sgml
telestrat.sgml
tgi.sgml Update tgi.sgml 2018-05-23 13:34:37 +00:00
using-make.sgml
vic20.sgml Add CBM kernal call SECOND to CBM library (see issue #525) 2018-05-23 17:32:02 +02:00