aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEl-BG-1970 <elouan.gros.fr@gmail.com>2022-04-18 16:28:21 +0200
committerEl-BG-1970 <elouan.gros.fr@gmail.com>2022-04-18 16:28:21 +0200
commitc599aaf883472686fa2871ec48905b114c783180 (patch)
tree176b23134864c36d21545f6b835d99df7950fff7
parent2fd7e3647e70e6a925993c59d8c1751a904ae39a (diff)
downloadorg-to-conky-c599aaf883472686fa2871ec48905b114c783180.tar.gz
added NEXTWEEK
-rw-r--r--date.c2
-rw-r--r--main.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/date.c b/date.c
index 5bfe962..317b3d9 100644
--- a/date.c
+++ b/date.c
@@ -151,5 +151,5 @@ Date nextmonth(Date td) {
Date nextmonday(Date td) {
if (td.weekday == MON) return nextweek(td);
else if (td.weekday == SUN) return adjust_date((Date){ td.day+1, td.month, td.year, MON });
- else return adjust_date((Date){ td.day+(td.weekday-MON)+1, td.month, td.year, MON });
+ else return adjust_date((Date){ td.day+(7-td.weekday)+1, td.month, td.year, MON });
}
diff --git a/main.c b/main.c
index 64ac9b2..8aa45fb 100644
--- a/main.c
+++ b/main.c
@@ -80,6 +80,7 @@ int main(int argc, char **argv) {
Date td = today();
Date tm = tomorrow(td);
Date nm = nextmonday(td);
+ Date nnm = nextweek(nm);
Date end = nextmonth(td);
Date last_date = (struct Date){ -1, -1, -1, -1};
for (int i = 0; i < idx; i++) {
@@ -95,6 +96,8 @@ int main(int argc, char **argv) {
printf("\n%s [TOMORROW]:\n", e);
else if (strictly_smaller(last_date, nm))
printf("\n%s [THIS WEEK]:\n", e);
+ else if (strictly_smaller(last_date, nnm))
+ printf("\n%s [NEXT WEEK]:\n", e);
else if (smaller(last_date, end))
printf("\n%s:\n", e);
free(e);