summaryrefslogtreecommitdiff
path: root/notmuch.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-10-23 15:50:48 -0700
committerCarl Worth <cworth@cworth.org>2009-10-23 15:55:36 -0700
commitcbb2675ec5b52c76cd17b2cb3feb87d88aa134a7 (patch)
tree6aa80451457679a263d3663c744dca09395c6833 /notmuch.c
parent491ece966fbc0e8bcd14f2db87b10a6af82814cc (diff)
Print a better message than "0s" for zero seconds.
It's nice to have a tool that at least construct actual sentences.
Diffstat (limited to 'notmuch.c')
-rw-r--r--notmuch.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/notmuch.c b/notmuch.c
index ed087a0..d4e0745 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -81,6 +81,11 @@ print_formatted_seconds (double seconds)
int hours;
int minutes;
+ if (seconds < 1) {
+ printf ("almost no time");
+ return;
+ }
+
if (seconds > 3600) {
hours = (int) seconds / 3600;
printf ("%dh ", hours);
@@ -436,8 +441,12 @@ setup_command (int argc, char *argv[])
tv_now);
printf ("Processed %d total files in ", add_files_state.processed_files);
print_formatted_seconds (elapsed);
- printf (" (%d files/sec.). \n",
- (int) (add_files_state.processed_files / elapsed));
+ if (elapsed > 1) {
+ printf (" (%d files/sec.). \n",
+ (int) (add_files_state.processed_files / elapsed));
+ } else {
+ printf (". \n");
+ }
printf ("Added %d unique messages to the database.\n\n",
add_files_state.added_messages);
@@ -490,14 +499,18 @@ new_command (int argc, char *argv[])
if (add_files_state.processed_files) {
printf ("Processed %d total files in ", add_files_state.processed_files);
print_formatted_seconds (elapsed);
- printf (" (%d files/sec.). \n",
- (int) (add_files_state.processed_files / elapsed));
+ if (elapsed > 1) {
+ printf (" (%d files/sec.). \n",
+ (int) (add_files_state.processed_files / elapsed));
+ } else {
+ printf (". \n");
+ }
}
if (add_files_state.added_messages) {
printf ("Added %d new messages to the database (not much, really).\n",
add_files_state.added_messages);
} else {
- printf ("No new mail---and that's not much!.\n");
+ printf ("No new mail---and that's not much!\n");
}
if (ret) {