/* File time.h.  Provide an ADT for managing times.  Because both "clock"
 * and "time" are predefined identifiers in OOT, the type is called ClockTime.
 */
#ifndef _TIME_H
#define _TIME_H


#include "bool.h"

/* How many characters a time will take up on the screen*/
#define DISPLAYWIDTH 5
#define TIME_LEN 6

/* The Time data type.  Includes hours and minutes.*/
typedef struct ClockType {
    int hour;
    int minute;
} ClockTime;

/* Make
 *----------------------------------------------------------------
 * Return a ClockTime item corresponding to hour and minute.
 */
ClockTime
MakeTime(int hour, int minute);


/* MakeFromString
 *----------------------------------------------------------------
 * Return a ClockTime item from a string of the format "hh:mm".
 */
ClockTime
MakeTimeFromString(char *stime);


/* GetHour
 *----------------------------------------------------------------
 * Return the hour portion of t.
 */
int
GetHour(ClockTime t);


/* GetMinute
 *----------------------------------------------------------------
 * Return the minute portion of t.
 */
int
GetMinute(ClockTime t);


/* Display
 *----------------------------------------------------------------
 * Put t in the format hh:mm.  Do not put a newline.
 */
void 
DisplayTime(ClockTime t);


/* DisplayString
 *----------------------------------------------------------------
 * Return t as a string in the format hh:mm.
 */
char *
DisplayTimeString(ClockTime t, char *timeStr);


/* GreaterThan
 *----------------------------------------------------------------
 * Return true if t1 is later than t2, false otherwise.
 */
boolean
TimeGreaterThan(ClockTime t1, ClockTime t2);


/* Equal
 *----------------------------------------------------------------
 * Return true if t1 = t2, false otherwise.
 */
boolean
TimeEqual(ClockTime t1, ClockTime t2);


/* Difference
 *----------------------------------------------------------------
 * Return the number of hours and minutes between t1 and t2.
 * t2 must be at least as big as t1.
 */
ClockTime
TimeDifference(ClockTime t1, ClockTime t2);
 

/* Add
 *----------------------------------------------------------------
 * Add t1 and t2 and return the result.
 */
ClockTime
TimeAdd(ClockTime t1, ClockTime t2);

#endif
