aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2006-09-14 14:53:16 +0000
committerFrederic Culot <calcurse@culot.org>2006-09-14 14:53:16 +0000
commitb10e38e1824643eb5e2d8a2d0feb229fb5dbb9ab (patch)
tree7b2151935a451c9a20f144661393f13744016827
parented73629e6841f9106f246a472418a3da1b857428 (diff)
downloadcalcurse-b10e38e1824643eb5e2d8a2d0feb229fb5dbb9ab.tar.gz
calcurse-b10e38e1824643eb5e2d8a2d0feb229fb5dbb9ab.zip
today() created
-rwxr-xr-xsrc/utils.c19
-rwxr-xr-xsrc/utils.h3
2 files changed, 20 insertions, 2 deletions
diff --git a/src/utils.c b/src/utils.c
index c7f4199..9d795dc 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/* $calcurse: utils.c,v 1.6 2006/09/07 13:25:16 culot Exp $ */
+/* $calcurse: utils.c,v 1.7 2006/09/14 14:53:16 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -614,3 +614,20 @@ void other_status_page(int panel)
status_page = 1;
}
}
+
+long today(void)
+{
+ struct tm *lt;
+ time_t current_time;
+ long current_day;
+ int year, month, day;
+
+ current_time = time(NULL);
+ lt = localtime(&current_time);
+ month = lt->tm_mon + 1;
+ day = lt->tm_mday;
+ year = lt->tm_year + 1900;
+ current_day = date2sec(year, month, day, 0, 0);
+
+ return current_day;
+}
diff --git a/src/utils.h b/src/utils.h
index fbc6298..bf80f4b 100755
--- a/src/utils.h
+++ b/src/utils.h
@@ -1,4 +1,4 @@
-/* $calcurse: utils.h,v 1.2 2006/09/06 17:08:08 culot Exp $ */
+/* $calcurse: utils.h,v 1.3 2006/09/14 14:53:24 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -70,5 +70,6 @@ void display_item(WINDOW *win, int incolor, char *msg,
int len, int y, int x);
void reset_status_page(void);
void other_status_page(int panel);
+long today(void);
#endif /* CALCURSE_UTILS_H */