1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-04 17:04:58 +00:00
cc65/libsrc
Oliver Schmidt f40dcb5883 Added clock_getres() / clock_settime() for the Apple II.
The situation on the Apple II is rather special: There are several types of RTCs. It's not desirable to have specific code for all of them. As the OS supports file timestamps RTC owners usually use OS drivers for their RTC. Those drivers read the RTC and write the result in a "date/time location" in RAM. The OS reads the date/time from the RAM location. If there's no RTC the RAM location keeps containing zeros. The OS uses those zeros as timestamps and the files show up in a directory as "<NO DATE>".

There's no common interface to set RTCs so if an RTC _IS_ present there's just nothing to do. However, if there's _NO_ RTC present the user might very well be interest to "manually" set the RAM location in order to have timestamps. But he surely doesn't want to manually set the RAM location over an over again. Rather he wants to set it just once after booting the OS.

From that perspective it makes most sense to not set both the date and the time but rather only set the date and have the time just stay zero. Then files show up in a directory as "DD-MON-YY  0:00".

So clock_settime() checks if the current time equals 0:00. If it does _NOT_ then an RTC is supposed to be active and clock_settime() fails with ERANGE. Otherwise clock_settime() ignores sets the date - and completely ignores the time provided as parameter.

clock_getres() too checks if the current time equals 0:00. If it does _NOT_ then an RTC is supposed to be active and clock_getres() returns a time resolution of one minute. Otherwise clock_getres() presumes that the only one who sets the RAM location is clock_settime() and therefore returns a time resolution of one day.
2018-08-15 21:34:35 +02:00
..
apple2 Added clock_getres() / clock_settime() for the Apple II. 2018-08-15 21:34:35 +02:00
atari Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
atari2600
atari5200
atmos Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
c16 Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
c64 Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
c128 Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
cbm Added clock_getres() for CBMs. 2018-08-15 19:40:27 +02:00
cbm510 Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
cbm610 Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
common Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
conio Further optimizations in common/conio. 2018-05-22 16:00:05 +02:00
creativision
dbg Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
em
gamate
geos-apple
geos-cbm
geos-common Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
joystick
lynx
mouse
nes Clean-up because of tgidrv_line.inc 2018-05-22 22:32:50 +00:00
none
osic1p
pce Merge branch 'master' into popptr1 2018-05-21 13:33:14 +02:00
pet Use common include file cbm_kernal.inc 2018-07-01 09:56:37 +03:00
plus4 Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
runtime Some minor cleanups. 2018-07-26 14:35:26 +02:00
serial
sim6502
supervision spaces instead of tab 2018-06-06 21:18:47 +02:00
telestrat Merge branch 'master' into popptr1 2018-05-21 13:33:14 +02:00
tgi Fixed some code, to adapt to register-use changes caused by pull request #652. 2018-07-27 09:21:31 -04:00
vic20 TAB to space conversion 2018-06-30 16:25:43 +03:00
zlib Fixed some code, to adapt to register-use changes caused by pull request #652. 2018-07-27 09:21:31 -04:00
Makefile