Skip to content

Commit aef6c22

Browse files
committed
timestamps
1 parent 019b75a commit aef6c22

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/fill-postgresql.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <boost/iostreams/filter/zlib.hpp>
1111
#include <boost/iostreams/filtering_stream.hpp>
1212
#include <boost/program_options.hpp>
13+
#include <chrono>
1314
#include <cstdlib>
1415
#include <functional>
1516
#include <iostream>
@@ -769,7 +770,8 @@ struct session : enable_shared_from_this<session> {
769770

770771
if (stop_before && result.this_block->block_num >= stop_before) {
771772
close_streams();
772-
cerr << "block " << result.this_block->block_num << ": stop requested\n";
773+
auto n = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
774+
cerr << std::put_time(std::localtime(&n), "%F %T: ") << "block " << result.this_block->block_num << ": stop requested\n";
773775
return false;
774776
}
775777

@@ -781,8 +783,10 @@ struct session : enable_shared_from_this<session> {
781783

782784
if (!bulk || !(result.this_block->block_num % 200))
783785
close_streams();
784-
if (!bulk)
785-
cerr << "block " << result.this_block->block_num << "\n";
786+
if (!bulk) {
787+
auto n = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
788+
cerr << std::put_time(std::localtime(&n), "%F %T: ") << "block " << result.this_block->block_num << "\n";
789+
}
786790

787791
pqxx::work t(sql_connection);
788792
pqxx::pipeline pipeline(t);
@@ -833,7 +837,8 @@ struct session : enable_shared_from_this<session> {
833837
pipeline.complete();
834838
t.commit();
835839

836-
cerr << "block " << first_bulk << " - " << head << "\n";
840+
auto n = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
841+
cerr << std::put_time(std::localtime(&n), "%F %T: ") << "block " << first_bulk << " - " << head << "\n";
837842
first_bulk = 0;
838843
}
839844

0 commit comments

Comments
 (0)