diff options
author | katherine <ageha@airen-no-jikken.icu> | 2019-12-18 21:54:46 -0700 |
---|---|---|
committer | katherine <ageha@airen-no-jikken.icu> | 2019-12-18 21:54:46 -0700 |
commit | 31632d4edbd903826cbf8f6bb93969f0d1a983fb (patch) | |
tree | 3ca5c8323d44d68c5e24bfd2aa2e65387c0892f3 /src/entry.c | |
parent | 65cb88bf620581205fffba3049822f97961dbec1 (diff) | |
download | every-31632d4edbd903826cbf8f6bb93969f0d1a983fb.tar.gz |
implement calendar parsing
Diffstat (limited to 'src/entry.c')
-rw-r--r-- | src/entry.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/entry.c b/src/entry.c index 64acdea..f903d97 100644 --- a/src/entry.c +++ b/src/entry.c @@ -93,19 +93,19 @@ static int sub_inc_minute(struct tm *t, int n) static int sub_inc_second(struct tm *t, int n) { - time_t r; + time_t rt; struct tm *tmp; if (n == 0) return 0; - r = mktime(t); + rt = mktime(t); - if (r + n <= r) + if (rt + n <= rt) return -1; - r += n; + rt += n; - tmp = localtime(&r); + tmp = localtime(&rt); *t = *tmp; return 0; @@ -116,7 +116,7 @@ static int sub_inc_second(struct tm *t, int n) bool entry_is_active(struct entry_s *e, time_t now) { struct tm t, *tmp; - time_t rtmp, now_plus_warn; + time_t rt, now_plus_warn; assert(e != NULL); @@ -153,13 +153,13 @@ bool entry_is_active(struct entry_s *e, time_t now) if (e->has_end && now > e->end) return false; - for (rtmp = e->start;;) { - rtmp = mktime(&t); + for (rt = e->start;;) { + rt = mktime(&t); - if (rtmp > now_plus_warn) + if (rt > now_plus_warn) return false; - if (rtmp >= now) + if (rt >= now) return true; if (sub_inc_year(&t, e->every.year)) |