time-util: don't use plural units indiscriminately
authorAnders Wenhaug <awenhaug@gmail.com>
Sun, 20 Jun 2021 19:43:07 +0000 (21:43 +0200)
committerAnders Wenhaug <anders@wenhaug.no>
Sun, 20 Jun 2021 19:54:37 +0000 (21:54 +0200)
commit45eb4d2261ed0d943fd503a6d79ee3b7b7558c09
treeaeff0d369e528e7762053aa2b6f40b2b331e2c16
parentdf8fd03a7dcf2f06cd9e2ee3eed60c3a83b43ccc
time-util: don't use plural units indiscriminately

format_timestamp_relative currently returns the plural form of
years and months no matter the quantity, and in many cases (for
durations > 1 week) this is the same with days.

This patch changes this so that the function takes the quantity into account,
returning "1 month 1 week ago" instead of "1 months 1 weeks ago".
src/basic/time-util.c
src/test/test-time-util.c