From b10e38e1824643eb5e2d8a2d0feb229fb5dbb9ab Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Thu, 14 Sep 2006 14:53:16 +0000 Subject: today() created --- src/utils.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/utils.c') 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(¤t_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; +} -- cgit v1.2.3-54-g00ecf