Download tot_time.h
//Functions for calculating total time of a given
//session type.
#ifndef TOT_TIME_H
#define TOT_TIME_H
#include"log_entry_ll.h"
//Returns total num of minutes of SESSIONTYPE type.
//p should point to start of list.
int totalminutes(const LOG_INDEX* pc, enum SESSIONTYPE type) {
LOG_INDEX* p = (LOG_INDEX*) pc;
int tot_min=0;
for(;p != NULL; p = p->next) {
if((p->entryPtr)->sessiontype == type)
tot_min += numMin(p->entryPtr);
}
return tot_min;
}
struct mytime2 { //Like mytime, but with int members.
int hours;
int minutes;
};
//Convert minutes to hrs, minutes -- in
//return struct of type mytime2.
struct mytime2 minToHrs(int minutes) {
struct mytime2 tot_time;
tot_time.hours = minutes/60;
tot_time.minutes = minutes%60;
return tot_time;
}
#endif