1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 19:29:37 +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 Add C support for Atari 2600 (VCS) 2017-01-13 21:12:22 +01:00
atari5200 Removed IRQ support from joystick drivers. 2018-02-01 22:38:36 +01:00
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 Removed IRQ support from joystick drivers. 2018-02-01 22:38:36 +01:00
dbg Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
em Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
gamate Removed IRQ support from joystick drivers. 2018-02-01 22:38:36 +01:00
geos-apple directory structure changed from driver-centric to target-centric 2016-05-16 19:49:43 +02:00
geos-cbm Made dio_read(), dio_write(), and dio_write_verify() catch sector number conversion errors. 2018-02-23 16:12:12 -05:00
geos-common Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
joystick Removed IRQ support from joystick drivers. 2018-02-01 22:38:36 +01:00
lynx Removed IRQ support from TGI drivers. 2018-02-02 18:15:45 +01:00
mouse Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
nes Clean-up because of tgidrv_line.inc 2018-05-22 22:32:50 +00:00
none crt0.s ("none" target): fix initialization of sp variable. 2018-01-11 13:15:19 +01:00
osic1p Removed CBM chartype table. 2017-12-02 11:04:59 +01:00
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 Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
sim6502 Renamed RAM to MAIN for all disk based targets. 2016-03-07 01:28:55 +01:00
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 Implemented the requested changes. 2018-01-04 11:17:20 +01:00