|
Previous Top Next |
Prototype: | (Long pClock, Byte pIntervalMin, Byte pRoundUp),Long |
pClock | Time value. |
pIntervalMin | Interval in minutes. |
pRoundUp | Rounds up if True or down if false. |
Return | Time value after rounding up or down to the given interval. |
This function takes a clock value and rounds it up or down to the nearest clock indicated in the pIntervalMin. This is very useful for schedule type of calculation where an appointment should be scheduled for example with 15 minute intervals starting at the hour, i.e. at 18:00, 18:15, 18:30 and 18:45. This function makes it very easy to do that. Simply give it the time, interval in minutes and if it should round up or down and it will return the correct time value.
Example:
C1 Long
C2 Long
I Byte
R Byte
ITU ITUtilityClass
Code
C1 = ITU.GetClockFromString('18:16:00')
I = 15 ! 15 minute interval
R = True
C1 = ITU.GetClockValue(C1,I,R)
I = 15 ! 15 minute interval
R = False
C2 = ITU.GetClockValue(C1,I,R)
C1 would be equal to 18:30:00 but C2 would be equal to 18:15:00
See also: