Thanks for the submission. As you point out, it doesn't work properly if the date is before 1904. Wouldn't happen very often.. so it could probably be best guarded against with a simple check and exception if the passed date is earlier than it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is a function that I couldn't find in your code to convert a TDateTime to TimSeconds:
function DateTimeToTimSeconds(DateTime:TDateTime):LongWord;
const
SecsPerDay = 24 * 60 * 60;
begin
if DateTime = 0 then
Result := 0
else
result := ((Trunc(DateTime) - Trunc(EncodeDate(1904, 1, 1))) * SecsPerDay) + Round(frac(DateTime)*SecsPerDay);
end;
Thanks for your help.
Actually it probably needs to be corrected still.
I noticed, after I posted the code, that if the TDateTime is earlier than 1904 you'll get an incorrect result.
I'll correct that in my own code.
Thanks for the submission. As you point out, it doesn't work properly if the date is before 1904. Wouldn't happen very often.. so it could probably be best guarded against with a simple check and exception if the passed date is earlier than it.
Hi
Don't we already have the same tool with the DateTimeToPalmDT function located in pelDateTime unit?
Good point. The library has gotten big enough that not even I can remember all of it's functions off the top of my head any more. :)