#include #include #include "wtime.h" #include "wutil.h" /** * make a print rep of the provided Time object * @param target -- a string to put the print rep into * @param time -- the time object * **/ void timeToString(char* target, Time* time) { sprintf(target, "%s %s", time->time, time->ampm); } /** * Time constructor * @param tim -- a string containing the time * @param ap -- a string containing am or pm * **/ Time* makeTime(char* tim, char * ap) { Time* rtn = malloc(sizeof(Time)); rtn->time = strmcopy(tim); rtn->ampm = strmcopy(ap); return rtn; } /** * Time destructor * @param tim -- the structure to be destroyed * **/ void freeTime(Time * tim) { free(tim->time); free(tim->ampm); free(tim); }