{ first from milliseconds to datetime }
procedure TIsoTime.set_AsInteger(const aValue: ptrint); //bm
var
H,M,S,MSec: word;
L: cardinal; // leftover can be a pretty high number :-)
begin
// 14.08.2022 new implementation, stored as milliseconds per day
// formula: fIntTime = ((H*3600000) + (M*60000) + (S*1000) + MSec
// H = fIntTime div 3600000; L = fIntTime mod 3600000
// M = L div 60000; L = L mod 60000
// S = L div 1000
// MSec = L mod 1000
if aValue <> fIntTime then begin
fIntTime:= aValue;
H:= fIntTime div 3600000; L:= fIntTime mod 3600000;
M:= L div 60000; L:= L mod 60000;
S:= L div 1000;
MSec:= L mod 1000;
fTime:= EncodeTime(H,M,S,MSec);
end;
end;