From ab47868639750010db01d7e846c9203bd7f00b2d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 2 Apr 2020 18:39:41 +0200 Subject: [PATCH] Change lastModified to the number of seconds in the epoch 'lastModifiedDate' is now a string representing the equivalent date/time. --- flake.nix | 2 +- src/libexpr/primops/fetchTree.cc | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index f0e669f63..d954bd29d 100644 --- a/flake.nix +++ b/flake.nix @@ -13,7 +13,7 @@ versionSuffix = if officialRelease then "" - else "pre${builtins.substring 0 8 self.lastModified}_${self.shortRev or "dirty"}"; + else "pre${builtins.substring 0 8 self.lastModifiedDate}_${self.shortRev or "dirty"}"; officialRelease = false; diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc index 79ddc45f5..8a4970726 100644 --- a/src/libexpr/primops/fetchTree.cc +++ b/src/libexpr/primops/fetchTree.cc @@ -34,9 +34,11 @@ void emitTreeAttrs( if (tree.info.revCount) mkInt(*state.allocAttr(v, state.symbols.create("revCount")), *tree.info.revCount); - if (tree.info.lastModified) - mkString(*state.allocAttr(v, state.symbols.create("lastModified")), + if (tree.info.lastModified) { + mkInt(*state.allocAttr(v, state.symbols.create("lastModified")), *tree.info.lastModified); + mkString(*state.allocAttr(v, state.symbols.create("lastModifiedDate")), fmt("%s", std::put_time(std::gmtime(&*tree.info.lastModified), "%Y%m%d%H%M%S"))); + } v.attrs->sort(); }