leapsecs_add.c (389B)
1 #include <tai/leapsecs.h> 2 #include <tai/tai.h> 3 4 /* XXX: breaks tai encapsulation */ 5 6 extern struct tai *leapsecs; 7 extern int leapsecs_num; 8 9 void leapsecs_add(struct tai *t, int hit) 10 { 11 int i; 12 uint64 u; 13 14 if (leapsecs_init() == -1) return; 15 16 u = t->x; 17 18 for (i = 0;i < leapsecs_num;++i) { 19 if (u < leapsecs[i].x) break; 20 if (!hit || (u > leapsecs[i].x)) ++u; 21 } 22 23 t->x = u; 24 }