summaryrefslogtreecommitdiff
path: root/src/ctime.c
blob: 60cafb7de36be0c320031ea8791454bc88fb3d5c (plain)
    1 #include "ctime.h"
    2 
    3 void ctime_t_new(ctime_t* t) {
    4   t->sec = 0;
    5   t->min = 0;
    6   t->hour = 0;
    7   t->day = 0;
    8   t->month = 0;
    9   t->year = 0;
   10 }
   11 
   12 int ctime_add_sec(ctime_t* t, int duration) {
   13   t->sec += duration;
   14   if(t->sec > 59) {
   15     // Increment minute
   16     t->min++;
   17     // TODO: This doesn't work when duration > 1. Need better logic here.
   18     t->sec = 0;
   19   }
   20   return 0;
   21 }

Generated by cgit