aboutsummaryrefslogtreecommitdiffstats
path: root/src/calendar.c
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-08-10 09:24:46 +0000
committerFrederic Culot <calcurse@culot.org>2008-08-10 09:24:46 +0000
commit1674800d5fb26decfa74cb7a1d94e2154b7c27a6 (patch)
tree1e7b15d77ed74c2c150c9a1dc05cd709bba3ac81 /src/calendar.c
parentcc3b4303056d891c4782469be50be21ca50e2271 (diff)
downloadcalcurse-1674800d5fb26decfa74cb7a1d94e2154b7c27a6.tar.gz
calcurse-1674800d5fb26decfa74cb7a1d94e2154b7c27a6.zip
pcal export added
Diffstat (limited to 'src/calendar.c')
-rwxr-xr-xsrc/calendar.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/src/calendar.c b/src/calendar.c
index c6a4676..94dd870 100755
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -1,4 +1,4 @@
-/* $calcurse: calendar.c,v 1.16 2008/08/03 18:41:55 culot Exp $ */
+/* $calcurse: calendar.c,v 1.17 2008/08/10 09:24:46 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -399,7 +399,7 @@ calendar_change_day (int datefmt)
* Used to change date by adding a certain amount of days or weeks.
* Returns 0 on success, 1 otherwise.
*/
-int
+static int
date_change (struct tm *date, int delta_month, int delta_day)
{
struct tm t;
@@ -485,6 +485,44 @@ calendar_move (move_t move)
}
}
+/* Returns the beginning of current year as a long. */
+long
+calendar_start_of_year (void)
+{
+ time_t timer;
+ struct tm *tm;
+
+ timer = time (NULL);
+ tm = localtime (&timer);
+ tm->tm_mon = 0;
+ tm->tm_mday = 1;
+ tm->tm_hour = 0;
+ tm->tm_min = 0;
+ tm->tm_sec = 0;
+ timer = mktime (tm);
+
+ return (long)timer;
+}
+
+long
+calendar_end_of_year (void)
+{
+ time_t timer;
+ struct tm *tm;
+
+ timer = time (NULL);
+ tm = localtime (&timer);
+ tm->tm_mon = 0;
+ tm->tm_mday = 1;
+ tm->tm_hour = 0;
+ tm->tm_min = 0;
+ tm->tm_sec = 0;
+ tm->tm_year++;
+ timer = mktime (tm);
+
+ return (long)(timer - 1);
+}
+
/*
* The pom, potm, dotr, adj360 are used to compute the current
* phase of the moon.