[osmium-tool] 11/97: Add first and last timestamp to fileinfo output.

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Tue Jul 21 20:15:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to tag v1.0.0
in repository osmium-tool.

commit 70061c51b934eeec97a550c30429d9c21e2d9f4d
Author: Jochen Topf <jochen at topf.org>
Date:   Sun Jun 29 10:41:15 2014 +0200

    Add first and last timestamp to fileinfo output.
---
 src/command_fileinfo.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/command_fileinfo.cpp b/src/command_fileinfo.cpp
index d2ecf2f..e54096f 100644
--- a/src/command_fileinfo.cpp
+++ b/src/command_fileinfo.cpp
@@ -94,8 +94,19 @@ struct InfoHandler : public osmium::handler::Handler {
     uint64_t nodes = 0;
     uint64_t ways = 0;
     uint64_t relations = 0;
+    osmium::Timestamp first_timestamp = osmium::end_of_time();
+    osmium::Timestamp last_timestamp = osmium::start_of_time();
     CryptoPP::SHA hash {};
 
+    void osm_object(const osmium::OSMObject& object) {
+        if (object.timestamp() < first_timestamp) {
+            first_timestamp = object.timestamp();
+        }
+        if (object.timestamp() > last_timestamp) {
+            last_timestamp = object.timestamp();
+        }
+    }
+
     void node(const osmium::Node& node) {
         hash.Update(node.data(), node.byte_size());
         bounds.extend(node.location());
@@ -155,6 +166,8 @@ bool CommandFileinfo::run() {
             osmium::apply(reader, info_handler);
             std::cout << "Data: " << "\n";
             std::cout << "  Bounding box: " << info_handler.bounds << "\n";
+            std::cout << "  First timestamp: " << info_handler.first_timestamp << "\n";
+            std::cout << "  Last timestamp: " << info_handler.last_timestamp << "\n";
 
             unsigned char digest[CryptoPP::SHA::DIGESTSIZE];
             info_handler.hash.Final(digest);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osmium-tool.git



More information about the Pkg-grass-devel mailing list