times.h (1111B)
1 enum time_field { 2 StartTime, 3 BreakStartTime, 4 BreakEndTime, 5 EndTime 6 }; 7 8 enum time_flag { 9 StartTimeFlag = 1, 10 BreakStartTimeFlag = 2, 11 BreakEndTimeFlag = 4, 12 EndTimeFlag = 8 13 }; 14 15 struct timesheet; 16 17 struct timesheet { 18 time_t times[4]; /* raw time data */ 19 enum time_flag set; /* which times are set */ 20 unsigned int period; /* period of the times, 0 if not set */ 21 struct timesheet *prev, *next; /* previous and next entry */ 22 size_t entry; /* the entry, unique in each user's timesheets */ 23 }; 24 25 extern char *timefields[]; 26 extern enum time_flag timeflagmap[]; 27 28 int settime(struct pagedata *pd, char *hash, enum time_field f, time_t time); 29 int deletetime(struct pagedata *pd, char *hash, size_t entry); 30 int breaktime(struct pagedata *pd, char *hash); 31 void freetimesheet(struct timesheet *ts); 32 struct timesheet *newtimesheet(void); 33 struct timesheet *inserttimesheet(struct timesheet *ts, struct timesheet *list); 34 void timesheet_set(struct timesheet *ts, enum time_field f, time_t v); 35 int gettimes(struct pagedata *pd, char *hash, int period, struct timesheet **rtimes); 36 time_t getduration(struct timesheet *ts);