You are not logged in.
Pages: 1
Hi, (latest mormot from github, D11.2ent)
if I do:
var isotime: TSynSystemTime;
if isotime.FromText('1962-11-12T21:59:48') then
or
if isotime.FromText('1962-11-12T21:59:48.000') then
result is false, because milliseconds are always 2333.
intialization of values are random numbers (milliseconds are 2333). Also year, ...
Maybe I'm missing soemthing.
thank you,
Vojko
Last edited by VojkoCendak (2023-06-14 07:13:29)
Offline
Yes, but the milliseconds are always 2333 (in my case) and the fuction ToDateTime fails,
because TryEncodeTime fails because milliseconds are greater then 1000.
maybe they should be always 0 then.
Last edited by VojkoCendak (2023-06-14 07:16:15)
Offline
Even if I use date only, milliseconds part is fixed in some random number:
isotime.FromText('1962-11-13');
dt := isotime.ToDateTime; // fails, because of millisecond part
function TSynSystemTime.ToDateTime: TDateTime;
var time: TDateTime;
begin
if TryEncodeDate(Year,Month,Day,result) then
if TryEncodeTime(Hour,Minute,Second,MilliSecond,time) then // fails !
result := result+time else
result := 0 else
result := 0;
end;
thank you
Offline
Please try https://github.com/synopse/mORMot/commit/25605342
(also backported on mORMot 2 via https://github.com/synopse/mORMot2/commit/42f36e34 )
Offline
yes it works. thank you
Offline
Hi,
we have another issue with TSynSystemTime.FromDate, where also minutes...milliseconds are not initialized to 0,
which lead to nasty things...
Offline
I disagree, it does what it is documented for: it fills Year/Month/Day fields.
Since you are confused, I am adding some explicit notice about it:
https://github.com/synopse/mORMot2/commit/3bde1cea
If you need something else, you need to call Clear before.
Offline
Pages: 1