From bec60b9f1f561c69d5ff72398bbb5b21bd1e16ad Mon Sep 17 00:00:00 2001
From: Avinash Baliga <fifoforlifo@gmail.com>
Date: Sun, 3 Mar 2013 21:33:19 -0600
Subject: NINJA_STATUS now takes %e for elapsed time.

---
 src/build.cc | 8 ++++++++
 src/build.h  | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/build.cc b/src/build.cc
index 701fa92..2f5b267 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -238,6 +238,14 @@ string BuildStatus::FormatProgressStatus(
         out += buf;
         break;
 
+      case 'e':
+      {
+        double elapsed = overall_rate_.Elapsed();
+        snprintf(buf, sizeof(buf), "%.3fs", elapsed);
+        out += buf;
+        break;
+      }
+
       default:
         Fatal("unknown placeholder '%%%c' in $NINJA_STATUS", *s);
         return "";
diff --git a/src/build.h b/src/build.h
index 23f653e..5747170 100644
--- a/src/build.h
+++ b/src/build.h
@@ -220,6 +220,7 @@ struct BuildStatus {
     RateInfo() : rate_(-1) {}
 
     void Restart() { stopwatch_.Restart(); }
+    double Elapsed() const { return stopwatch_.Elapsed(); }
     double rate() { return rate_; }
 
     void UpdateRate(int edges) {
-- 
cgit v0.12


From dce14e8e3dd42b2ef40f7b005f6a8696f6ad6a0a Mon Sep 17 00:00:00 2001
From: Avinash Baliga <fifoforlifo@gmail.com>
Date: Sun, 3 Mar 2013 22:04:48 -0600
Subject: Made %e purely a number.

---
 src/build.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/build.cc b/src/build.cc
index 2f5b267..74f5931 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -241,7 +241,7 @@ string BuildStatus::FormatProgressStatus(
       case 'e':
       {
         double elapsed = overall_rate_.Elapsed();
-        snprintf(buf, sizeof(buf), "%.3fs", elapsed);
+        snprintf(buf, sizeof(buf), "%.3f", elapsed);
         out += buf;
         break;
       }
-- 
cgit v0.12


From 5c132de2b75642edd2f1ead0da11689fcbc9d819 Mon Sep 17 00:00:00 2001
From: Avinash Baliga <fifoforlifo@gmail.com>
Date: Mon, 11 Mar 2013 00:15:46 -0500
Subject: Added %e to manual.asciidoc, fixed brace style.

---
 doc/manual.asciidoc | 3 ++-
 src/build.cc        | 3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/manual.asciidoc b/doc/manual.asciidoc
index 1e5b70b..5378d17 100644
--- a/doc/manual.asciidoc
+++ b/doc/manual.asciidoc
@@ -222,6 +222,7 @@ Several placeholders are available:
 `%f`:: The number of finished edges.
 `%o`:: Overall rate of finished edges per second
 `%c`:: Current rate of finished edges per second (average over builds specified by -j or its default)
+`%e`:: Elapsed time in seconds.  _(Available since Ninja 1.2.)_
 `%%`:: A plain `%` character.
 
 The default progress status is `"[%s/%t] "` (note the trailing space
@@ -684,7 +685,7 @@ keys.
   $variables are expanded) is passed directly to `sh -c` without
   interpretation by Ninja. Each `rule` may have only one `command`
   declaration. To specify multiple commands use `&&` (or similar) to
-  concatenate operations. 
+  concatenate operations.
 
 `depfile`:: path to an optional `Makefile` that contains extra
   _implicit dependencies_ (see <<ref_dependencies,the reference on
diff --git a/src/build.cc b/src/build.cc
index 74f5931..1e3ad9e 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -238,8 +238,7 @@ string BuildStatus::FormatProgressStatus(
         out += buf;
         break;
 
-      case 'e':
-      {
+      case 'e': {
         double elapsed = overall_rate_.Elapsed();
         snprintf(buf, sizeof(buf), "%.3f", elapsed);
         out += buf;
-- 
cgit v0.12

