Hi Eros,
Thanks
Replacements for DT_DateTimeAddSeconds, DT_DateTimeSubSeconds, DT_DateToSec, DT_SecToDate
I've done some more investigations and it looks like the DT routines that move between “Time” and seconds, work fine so long as you don't give them more than a days worth of seconds.
But the DT Routines that move between “Date” and seconds give errors sometimes. So I've written some quick replacements for the four above. They're a bit “quick and nasty” in that they don't do any validation on the date and they only accept the date in mm-dd-yyyy format (I figure that they need to be quick & the calling prog can do any validation that's needed.).
They take 1 Jan 1600 as the base date and work on the number of seconds to the START of the day i.e. DateToSec (“01-01-1600”) will return zero seconds, DateToSec (“01-02-1600”) will return 86400 seconds. The days run from “00:00:00” to “23:59:59”.
The new routines are named MYDT_ …. and are called exactly the same as their DT_... counterparts. (I figure that it should be easy to do a global edit of the calling program from “MYDT_” to “DT_” to get rid of them when the time comes).
I've attached a couple of files:
MYDT.tbasic which contains the routines and
MYDT_DateTimeTestHarness.tbasic which shows the tests I ran and is an example of how to call them
And finally a quick warning for anyone who might use them – I think they work, but when I started to use them for real I did find a couple of errors that had slipped through testing. They're now fixed, but there might be some more, so please feel free to do extra testing & let me know if something misbehaves.