settings struct now only uses seconds

This commit is contained in:
randomuser 2021-06-11 00:49:03 -05:00
parent 850cdcc525
commit b2ede86e69
1 changed files with 4 additions and 6 deletions

View File

@ -12,7 +12,6 @@ struct settings {
int d:1; /* count down/up (1/0) */
int b:1; /* ascii bel when done */
int f:1; /* display hours */
int m; /* minutes */
int s; /* seconds */
} s = {
.e = 0,
@ -20,13 +19,12 @@ struct settings {
.d = 0,
.b = 0,
.f = 0,
.m = 0,
.s = 0
};
int timerissettings(struct timer *t) {
if(t->s == 0) return 0;
if(s.m * 60 + s.s == t->s) return 1;
if(s.s == t->s) return 1;
return 0;
}
@ -42,7 +40,7 @@ void timerloop() {
struct timer *t = timerinit();
if(s.d) {
t->u = timerdec;
t->s = s.s + (s.m * 60);
t->s = s.s;
t->c = timerzero;
} else {
t->u = timerinc;
@ -88,8 +86,8 @@ int main(int argc, char **argv) {
break; case 'd': s.d = 1;
break; case 'b': s.b = 1;
break; case 'f': s.f = 1;
break; case 'm': s.m = atoi(optarg);
break; case 's': s.s = atoi(optarg);
break; case 'm': s.s = s.s + (atoi(optarg) * 60);
break; case 's': s.s = s.s + atoi(optarg);
break; case '?': return 1;
break; default: abort();
}