Never say 100% when not finished (part of #44).
authorCarl Hetherington <cth@carlh.net>
Tue, 12 Feb 2013 23:27:32 +0000 (23:27 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 12 Feb 2013 23:27:32 +0000 (23:27 +0000)
src/lib/job.cc

index 2ddcf5335cdb42111388530281d9c32149d6cd50..dd034bf0cf52d7225b2cb3b0d9f47927ed9165a9 100644 (file)
@@ -267,11 +267,17 @@ Job::status () const
        int const t = elapsed_time ();
        int const r = remaining_time ();
 
+       int pc = rint (p * 100);
+       if (pc == 100) {
+               /* 100% makes it sound like we've finished when we haven't */
+               pc = 99;
+       }
+
        stringstream s;
        if (!finished () && p >= 0 && t > 10 && r > 0) {
-               s << rint (p * 100) << "%; " << seconds_to_approximate_hms (r) << " remaining";
+               s << pc << "%; " << seconds_to_approximate_hms (r) << " remaining";
        } else if (!finished () && (t <= 10 || r == 0)) {
-               s << rint (p * 100) << "%";
+               s << pc << "%";
        } else if (finished_ok ()) {
                s << "OK (ran for " << seconds_to_hms (_ran_for) << ")";
        } else if (finished_in_error ()) {