Commit Graph

10 Commits

Author SHA1 Message Date
Stephen Heumann 84f471474a Use newer, more efficient ph2/ph4 macros throughout ORCALib.
These push DP values with pei, rather than lda+pha as in the old versions of the macros.
2022-06-30 19:01:47 -05:00
Stephen Heumann 5ad86f4a0b Implement strftime.
This is intended to be a complete implementation of strftime as specified in C17, although it lacks meaningful support for time zones or non-C locales.
2021-09-26 20:31:15 -05:00
Stephen Heumann 690ee7137f Add a function to get the proper value of CLOCKS_PER_SEC.
This may be either 50 or 60, depending on the system's video frequency setting (50Hz PAL or 60Hz NTSC). The video setting can be determined by inspecting bit 4 of the LANGSEL soft switch, documented in Appendix E of the Apple IIGS Firmware Reference.
2021-08-23 19:00:09 -05:00
Stephen Heumann e5360c9605 Spellcheck comments. 2020-02-16 13:29:53 -06:00
Stephen Heumann 573bc6efa9 Use consistent indentation within files.
Tabs have been expanded to spaces in several files that use mainly spaces for indentation.

The files ctype.asm, stdio.asm, and string.asm consistently use tabs for indentation. The tabs in these files have been left alone, except that a few tabs between sentences in comments were changed to spaces.  One space-indented line in stdio.asm was changed to use a tab.
2020-02-16 13:28:18 -06:00
Stephen Heumann 44dfc1d1d6 Prevent localtime() from potentially giving incorrect tm_isdst values.
This could happen when it was called for a time other than the present, because it set tm_isdst based on the current value of the DST flag in BRAM, which is valid only for the current time.

Now it works as follows: If localtime() is passed the time_t value that was produced by the most recent call to time(), it gives the DST setting in effect at the time of that call.  Otherwise, it sets tm_isdst to -1, indicating that the correct value is unknown.

This is about the best we can do without having a full timezone library/database. It should give the right tm_isdst value in probably the most common case, and avoids giving an incorrect value in any case (assuming the system's DST flag is right).

This fixes #18.
2020-02-02 12:52:42 -06:00
Stephen Heumann 21d34a30ce mktime: tm_yday should be indexed from 0 for January 1st, not 1.
This fixes the libca07.c test case.
2018-03-09 17:38:55 -06:00
Stephen Heumann a77e44d7b5 Fix asctime() to properly print years 1000 through 9999.
Also, use a leading space rather than a leading 0 in days 1 through 9.

This fixes the libca11.c test case.
2018-03-09 13:10:53 -06:00
Kelvin Sherlock 578bda8439 CR -> LF 2017-10-31 13:14:07 -04:00
mikew50 954c3a02b5 ORCA libraries, from the Opus ][ CD 2017-10-01 18:00:58 -06:00