< previous page page_853 next page >

Page 853
class TimeType
{
public:
    void Set( /* in */ int hours,
              /* in */ int minutes,
              /* in */ int seconds );
        // Precondition:
        //     0 <= hours <= 23  &&  0 <= minutes <= 59
        //  && 0 <= seconds <= 59
        // Postcondition;
        //     Time is set according to the incoming parameters
        // NOTE:
        //     This function MUST be called prior to
        //     any of the other member functions

    void Increment();
        // Precondition:
        //     The Set function has been invoked at least once
        // Postcondition:
        //     Time has been advanced by one second, with
        //     23:59:59 wrapping around to 0:0:0

    void Write() const;
        // Precondition:
        //     The Set function has been invoked at least once
        // Postcondition:
        //     Time has been output in the form HH:MM:SS

    Boolean Equal( /* in */ TimeType otherTime ) const;
        // Precondition:
        //     The Set function has been invoked at least once
        //     for both this time and otherTime
        // Postcondition:
        //     Function value == TRUE, if this time equals otherTime
        //                    == FALSE, otherwise

    Boolean LessThan( /* in */ TimeType otherTime ) const;
        // Precondition:
        //     The Set function has been invoked at least once
        //     for both this time and otherTime
        //  && This time and otherTime represent times in the
        //     same day
        // Postcondition:
        //     Function value == TRUE, if this time is earlier
        //                             in the day than otherTime
        //                    == FALSE, otherwise
private:
    int hrs;
    int mins;
    int secs;
};

 
< previous page page_853 next page >