Code optimization on minutes pr hour calculation
- by corger
Hi All,
The following code takes a timeframe in minutes since midnight and creates an array with minutes pr hour. But, it's slow. Any better suggestions out there? (no, changing language is not an option :-) )
Const clDeparture As Long = 123
Const clArrival As Long = 233
Dim lHour As Long
Dim lMinute As Long
Dim alHour(25) As Long
For lMinute = 0 To 1440
If lMinute >= clDeparture And lMinute < clArrival Then
alHour(Int(lMinute / 60)) = alHour(Int(lMinute / 60)) + 1
End If
Next
The array should now contain:
(0,0)
(1,0)
(2,57)
(3,53)
(4,0) .....
Regards