aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-12-16 12:40:14 +0100
committerEelco Dolstra <edolstra@gmail.com>2023-04-25 16:43:47 +0200
commita74d397549f987ee430be01f563e3fe9226ecb86 (patch)
tree4d3268cf696a3ef4cfe9c2f0f5584105d870c9d9 /src/nix
parent880e7b8ed6d666519cc39512a8d1b117506a5264 (diff)
nix build --json: Only show non-zero startTime / stopTime
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/build.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nix/build.cc b/src/nix/build.cc
index 4e133e288..abf946214 100644
--- a/src/nix/build.cc
+++ b/src/nix/build.cc
@@ -27,8 +27,10 @@ nlohmann::json builtPathsWithResultToJSON(const std::vector<BuiltPathWithResult>
std::visit([&](const auto & t) {
auto j = t.toJSON(store);
if (b.result) {
- j["startTime"] = b.result->startTime;
- j["stopTime"] = b.result->stopTime;
+ if (b.result->startTime)
+ j["startTime"] = b.result->startTime;
+ if (b.result->stopTime)
+ j["stopTime"] = b.result->stopTime;
if (b.result->cpuUser)
j["cpuUser"] = ((double) b.result->cpuUser->count()) / 1000000;
if (b.result->cpuSystem)