Skip to content

Commit 9d567af

Browse files
committed
Fix for MSVC: use auto type for std::chrono::steady_clock::now()
1 parent 1dda9fa commit 9d567af

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

DataStructures/StaticRTree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ class StaticRTree : boost::noncopyable
280280
<< " edge elements build on-top of " << coordinate_list.size()
281281
<< " coordinates";
282282

283-
std::chrono::time_point<std::chrono::steady_clock> time0 = std::chrono::steady_clock::now();
283+
auto time0 = std::chrono::steady_clock::now();
284284
std::vector<WrappedInputElement> input_wrapper_vector(m_element_count);
285285

286286
HilbertCode get_hilbert_number;
@@ -411,7 +411,7 @@ class StaticRTree : boost::noncopyable
411411
tree_node_file.write((char *)&m_search_tree[0], sizeof(TreeNode) * size_of_tree);
412412
// close tree node file.
413413
tree_node_file.close();
414-
std::chrono::time_point<std::chrono::steady_clock> time1 = std::chrono::steady_clock::now();
414+
auto time1 = std::chrono::steady_clock::now();
415415
std::chrono::duration<double> elapsed_seconds = time1 - time0;
416416
SimpleLogger().Write() << "finished r-tree construction in " << (elapsed_seconds.count())
417417
<< " seconds";

Extractor/ExtractionContainers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void ExtractionContainers::PrepareData(
6060
try {
6161
unsigned number_of_used_nodes = 0;
6262
unsigned number_of_used_edges = 0;
63-
std::chrono::time_point<std::chrono::steady_clock> time1 = std::chrono::steady_clock::now();
63+
auto time1 = std::chrono::steady_clock::now();
6464

6565
std::cout << "[extractor] Sorting used nodes ... " << std::flush;
6666
stxxl::sort(
@@ -69,7 +69,7 @@ void ExtractionContainers::PrepareData(
6969
Cmp(),
7070
4294967296
7171
);
72-
std::chrono::time_point<std::chrono::steady_clock> time2 = std::chrono::steady_clock::now();
72+
auto time2 = std::chrono::steady_clock::now();
7373
std::chrono::duration<double> elapsed_seconds = time2-time1;
7474
std::cout << "ok, after " << elapsed_seconds.count() << "s" << std::endl;
7575

extractor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ UUIDC uuid;
5555
int main (int argc, char *argv[]) {
5656
try {
5757
LogPolicy::GetInstance().Unmute();
58-
std::chrono::time_point<std::chrono::steady_clock> startup_time = std::chrono::steady_clock::now();
58+
auto startup_time = std::chrono::steady_clock::now();
5959

6060
boost::filesystem::path config_file_path, input_path, profile_path;
6161
int requested_num_threads;
@@ -221,7 +221,7 @@ int main (int argc, char *argv[]) {
221221
throw OSRMException("Parser not initialized!");
222222
}
223223
SimpleLogger().Write() << "Parsing in progress..";
224-
std::chrono::time_point<std::chrono::steady_clock> parsing_start_time = std::chrono::steady_clock::now();
224+
auto parsing_start_time = std::chrono::steady_clock::now();
225225

226226
parser->Parse();
227227
std::chrono::duration<double> parsing_duration = std::chrono::steady_clock::now() - parsing_start_time;

prepare.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ std::vector<ImportEdge> edgeList;
6666
int main (int argc, char *argv[]) {
6767
try {
6868
LogPolicy::GetInstance().Unmute();
69-
std::chrono::time_point<std::chrono::steady_clock> startupTime = std::chrono::steady_clock::now();
69+
auto startupTime = std::chrono::steady_clock::now();
7070

7171
boost::filesystem::path config_file_path, input_path, restrictions_path, profile_path;
7272
int requested_num_threads;
@@ -294,10 +294,12 @@ int main (int argc, char *argv[]) {
294294
boost::filesystem::ofstream mapOutFile(nodeOut, std::ios::binary);
295295
const unsigned size_of_mapping = internalToExternalNodeMapping.size();
296296
mapOutFile.write((char *)&size_of_mapping, sizeof(unsigned));
297-
mapOutFile.write(
298-
(char *)&(internalToExternalNodeMapping[0]),
299-
size_of_mapping*sizeof(NodeInfo)
300-
);
297+
if (size_of_mapping > 0) {
298+
mapOutFile.write(
299+
(char *)&(internalToExternalNodeMapping[0]),
300+
size_of_mapping*sizeof(NodeInfo)
301+
);
302+
}
301303
mapOutFile.close();
302304
std::vector<NodeInfo>().swap(internalToExternalNodeMapping);
303305

@@ -307,7 +309,7 @@ int main (int argc, char *argv[]) {
307309

308310
SimpleLogger().Write() << "initializing contractor";
309311
Contractor* contractor = new Contractor( edgeBasedNodeNumber, edgeBasedEdgeList );
310-
std::chrono::time_point<std::chrono::steady_clock> contraction_start_timestamp = std::chrono::steady_clock::now();
312+
auto contraction_start_timestamp = std::chrono::steady_clock::now();
311313

312314
contractor->Run();
313315
std::chrono::duration<double> contraction_duration = std::chrono::steady_clock::now() - contraction_start_timestamp;

0 commit comments

Comments
 (0)