mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-23 18:40:37 +02:00
bypass real
→ integer
conversion → real
promotion in dateUtils.dateOf
The `dateUtils.dateOf` function takes one `tDateTime` value, a `real` value, converts it to an `integer` using `trunc`, and then the value is automatically promoted to a `real` value again (because of result data type `tDateTime`). This is unnecessary (unless an error is the desired behavior). You can use just `system.int` to obtain the integral (= date) part of `tDateTime`.
This commit is contained in:
parent
f671db3fa6
commit
5307ef07c4
@ -622,7 +622,7 @@ end;
|
||||
|
||||
Function DateOf(const AValue: TDateTime): TDateTime; inline;
|
||||
begin
|
||||
Result:=Trunc(AValue);
|
||||
Result:=Int(AValue);
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user