PDA

View Full Version : Any suggestions in implementing this (Time calculation)?



Sunforever0220
17 Mar 2011, 6:01 AM
-Calculate the correct daily rest based on the inputs of starting time and ending time.
Pseudo code: Input DailyStartTime, DailyEndTime, NextStartTime (from a form)
If user chooses to calculate normal daily rest (from the button on index page)
If DailyEndTime < = DailyStartTime + 24hours
If NextStartTime >= DailyStartTime + 24hours
CurrentDailyRest ? 24 hours - (DailyEndTime - DailyStartTime),
Else
CurrentDailyRest ? NextStartTime - (DailyEndTime - DailyStartTime),
Else
Notify error to the user and back to input page;

If user chooses to calculate multi-manning daily rest(from the button on index page)
If DailyEndTime < = DailyStartTime + 30 hours
If NextStartTime >= DailyStartTime + 30hours
CurrentDailyRest ? 30 hours - (DailyEndTime - DailyStartTime),
Else
CurrentDailyRest ? NextStartTime - (DailyEndTime - DailyStartTime),
Else
Notify error to the user and back to input page;

-Identify whether it is a regular daily rest or reduced daily rest.
Pseudo code: If CurrentDailyRest >= 11 hours
Notify “It is a regular daily rest.”
Else if 9 hours <= CurrentDailyRest < 11 hours
Notify “It is a reduced daily rest.”
Else
Notify illegal daily rest and back to input page.

-Notify driver recommended next start time and rest time (normal daily rest):
Pseudo code:
NextRest ? NextStartTime + 24 hours – 11 hours, //recommended end working time
MustRest ? NextStartTime + 24 hours – 9 hours, //for reduced daily rest
Notify NextRest and MustRest;

-Notify driver to input the times for next working day
Pseudo code: Set alerts at every suggested starting rest times
If user chooses to input times
Navigate to the page requesting user inputs
Else if user chooses to take weekly rest
Cancel alarm