diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2013-07-17 13:55:42 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2013-07-17 13:55:42 +0200 |
commit | ae93db284edd4f5d90b5d930edfe5770615a316c (patch) | |
tree | 7fcf390a6da1d63aa769906846cf309c5f53116f /src | |
parent | 18b6e360b8e8b2f4aa813eceec0f07578f841b10 (diff) | |
download | calcurse-ae93db284edd4f5d90b5d930edfe5770615a316c.zip |
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 <calcurse@cryptocrack.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/utils.c | 8 |
1 files 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); |