1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
It simply returns -1 if time0 is before time1, 0 if the times are equal,
1 if time0 is after time1. Recall that we’re (arbitrarily) saying that the
first time in a week is Sunday 12:00 AM , and the last time in a week
is Saturday 11:59 PM (so the first possible time is one minute after the
last possible time).
For instance, compare ( {0, true, 11, 30}, {6, false, 9, 0} ) return -1 (Sunday is before Saturday)
For instance, compare( {3, true, 6, 0}, {3, true, 12, 0} ) returns 1
(Wednesday dinner is after Wednesday lunch)
For instance, compare( {1, false, 6, 30}, {1, false, 6, 30} ) returns 0
(Monday morning is Monday morning)
For instance, compare( {6, false, 10, 0}, {6, false, 10, 1} ) returns -1 (one minute makes a difference)
For instance, compare( {6, true, 8, 0}, {6, true, 1000, 0} ) complains
and dies (sorry, Saturdays aren’t that long)
|