{"thread":{"id":"23742","subject":"[PATCH REMINDER] date.c: print \"1 second ago\", not \"1 seconds ago\"","startedAt":"2010-05-08T09:27:30Z","lastAt":"2010-05-08T09:27:30Z","messageCount":1,"participants":["Øyvind A. Holm"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"141240","messageId":"20100508092730.GB26678@triton","threadId":"23742","inReplyTo":null,"subject":"[PATCH REMINDER] date.c: print \"1 second ago\", not \"1 seconds ago\"","fromName":"Øyvind A. Holm","fromEmail":"sunny@sunbase.org","sentAt":"2010-05-08T09:27:30Z","receivedAt":"2010-05-08T09:27:30Z","isPatch":true,"sender":{"key":"sunny@sunbase.org","avatar":"https://avatars.githubusercontent.com/u/113445?v=4"},"body":"Hi,\nresending a trivial patch for correcting the output of \"1 seconds\" to \n\"1 second\" when using --date=relative. The original patch was sent \n2010-04-21 07:31:00+0200. The patch is created against current master \n(ec768ed5) and passes all tests.\n\n\nFrom ec768ed5659b0e0f91c98a01c981bc359153a7b4 Mon Sep 17 00:00:00 2001\nFrom: =?UTF-8?q?=C3=98yvind=20A.=20Holm?= <sunny@sunbase.org>\nDate: Wed, 21 Apr 2010 06:21:06 +0200\nSubject: [PATCH] date.c: print \"1 second ago\", not \"1 seconds ago\"\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n\nWhen using --date=relative, print \"1 second ago\" instead of \"1 seconds\nago\".\n\nt0006: Add tests for 0, 1 and 2 seconds ago, to ensure that\n--date=relative prints \"1 second ago\" and \"x seconds ago\" when x != 1.\n\nSigned-off-by: Øyvind A. Holm <sunny@sunbase.org>\n---\n date.c          |    3 ++-\n t/t0006-date.sh |    4 ++++\n 2 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/date.c b/date.c\nindex 002aa3c..6aec22b 100644\n--- a/date.c\n+++ b/date.c\n@@ -96,7 +96,8 @@ const char *show_date_relative(unsigned long time, int tz,\n \t\treturn \"in the future\";\n \tdiff = now->tv_sec - time;\n \tif (diff < 90) {\n-\t\tsnprintf(timebuf, timebuf_size, \"%lu seconds ago\", diff);\n+\t\tsnprintf(timebuf, timebuf_size, \"%lu second%s ago\",\n+\t\t\t\tdiff, (diff != 1 ? \"s\" : \"\"));\n \t\treturn timebuf;\n \t}\n \t/* Turn it into minutes */\ndiff --git a/t/t0006-date.sh b/t/t0006-date.sh\nindex 75b02af..3069545 100755\n--- a/t/t0006-date.sh\n+++ b/t/t0006-date.sh\n@@ -15,6 +15,9 @@ check_show() {\n \t\"\n }\n \n+check_show 0 '0 seconds ago'\n+check_show 1 '1 second ago'\n+check_show 2 '2 seconds ago'\n check_show 5 '5 seconds ago'\n check_show 300 '5 minutes ago'\n check_show 18000 '5 hours ago'\n@@ -48,6 +51,7 @@ check_approxidate() {\n }\n \n check_approxidate now '2009-08-30 19:20:00'\n+check_approxidate '1 second ago' '2009-08-30 19:19:59'\n check_approxidate '5 seconds ago' '2009-08-30 19:19:55'\n check_approxidate 5.seconds.ago '2009-08-30 19:19:55'\n check_approxidate 10.minutes.ago '2009-08-30 19:10:00'\n-- \n1.7.1.11.g3bf78\n\n\n\n\nRegards,\nØyvind A. Holm\n(sunny256)\n"}]}