TvPlanIt: More robust comparison of TTime variables.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8173 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
ed6fcb4083
commit
a94f08651f
@ -1930,7 +1930,7 @@ begin
|
||||
ThisTime := 0.0;
|
||||
while (J < EventList.Count) and (J < MaxVisibleEvents) do begin
|
||||
event := EventList[J];
|
||||
if frac(event.StartTime) >= thisTime then begin
|
||||
if SameTime(frac(event.StartTime), thisTime) or (frac(event.StartTime) > thisTime) then begin
|
||||
thisTime := frac(event.EndTime);
|
||||
{ Handle end times of midnight }
|
||||
if thisTime = 0 then
|
||||
|
@ -146,6 +146,7 @@ function GetJulianDate(Date: TDateTime): Word;
|
||||
function GetWeekOfYear(ADate: TDateTime): byte;
|
||||
function IsWeekEnd(ADate: TDateTime): Boolean;
|
||||
function SameDate(dt1, dt2: TDateTime): Boolean;
|
||||
function SameTime(t1, t2: TTime): Boolean;
|
||||
function DateInRange(ADate, StartDate, EndDate: TDateTime; IncludeLimits: Boolean): Boolean;
|
||||
function TimeInRange(ATime, StartTime, EndTime: TDateTime; IncludeLimits: Boolean): Boolean;
|
||||
|
||||
@ -804,6 +805,14 @@ begin
|
||||
Result := trunc(dt1) = trunc(dt2);
|
||||
end;
|
||||
|
||||
{ Checks whether the two time values equal within a tolerance of 1 ms }
|
||||
function SameTime(t1, t2: TTime): Boolean;
|
||||
const
|
||||
ONE_MILLISECOND = 1.0/(24*60*60*1000);
|
||||
begin
|
||||
Result := SameValue(t1, t2, ONE_MILLISECOND);
|
||||
end;
|
||||
|
||||
// Calculates ISO week number (checked with Jan 1, 2016, which is in week 53).
|
||||
function GetWeekOfYear(ADate: TDateTime): byte;
|
||||
// wp: was in TvWeekView.
|
||||
|
Loading…
Reference in New Issue
Block a user