diff --git a/components/tvplanit/source/vpdayviewpainter.pas b/components/tvplanit/source/vpdayviewpainter.pas index 093eddc70..653fdbf02 100644 --- a/components/tvplanit/source/vpdayviewpainter.pas +++ b/components/tvplanit/source/vpdayviewpainter.pas @@ -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 diff --git a/components/tvplanit/source/vpmisc.pas b/components/tvplanit/source/vpmisc.pas index 5c8829f82..40af2feda 100644 --- a/components/tvplanit/source/vpmisc.pas +++ b/components/tvplanit/source/vpmisc.pas @@ -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.