From ae93db284edd4f5d90b5d930edfe5770615a316c Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Wed, 17 Jul 2013 13:55:42 +0200 Subject: print_datediff(): Actually print a date difference Instead of passing a date and printing the date difference between that date and the current date, pass an actual date difference. This allows for using the function in other places, such as for printing item durations. Signed-off-by: Lukas Fleischer --- src/utils.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/utils.c b/src/utils.c index bd5ff70..41bebee 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1238,15 +1238,12 @@ static void print_date(long date, long day, const char *extformat) } /* Print a time difference to stdout. */ -static void print_datediff(long date, const char *extformat) +static void print_datediff(long difference, const char *extformat) { const char *p; const char *numfmt; bool usetotal; long value; - time_t difference; - - difference = difftime(date, now()); if (!strcmp(extformat, "epoch")) { printf("%ld", difference); @@ -1335,7 +1332,8 @@ void print_apoint(const char *format, long day, struct apoint *apt) extformat); break; case FS_REMAINING: - print_datediff(apt->start, extformat); + print_datediff(difftime(apt->start, now()), + extformat); break; case FS_MESSAGE: printf("%s", apt->mesg); -- cgit v1.2.3-54-g00ecf