On Wed, Dec 13, 2017, at 22:07, Random832 wrote:
Making V6 do it (no long *or* unsigned type) is a bit
more involved, but
I'm close to something viable. Incidentally, one gotcha I've run into is
that the code as-is passes the year minus 1900 to dysize, whereas modern
dysize implementations that respect the 100 and 400 year rules require
the full year.
I managed to get it working - an implementation that works on V6 (well,
works on apout with the V6 compiler and library) for all dates between
1970-01-01 and 2106-02-07 06:28:15. I even tried to do as much as
possible in the register variables, to approximate the same performance
as the original (though I suspect the O(N) year incrementing loop
probably doesn't perform as well now as it did in 1975, especially with
a proper dysize implementation)
Other features: localtime supports all correct US rules and offsets
greater than 9 hours (though it still has the US rules and EST
hardcoded), and ctime supports Y2K (and 2.1K)
If anyone wants it I can post it somewhere, or just put it on the list.