VisionCpp  0.0.1
time.hpp
Go to the documentation of this file.
1 // This file is part of VisionCpp, a lightweight C++ template library
2 // for computer vision and image processing.
3 //
4 // Copyright (C) 2016 Codeplay Software Limited. All Rights Reserved.
5 //
6 // Contact: visioncpp@codeplay.com
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // Unless required by applicable law or agreed to in writing, software
15 // distributed under the License is distributed on an "AS IS" BASIS,
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 // See the License for the specific language governing permissions and
18 // limitations under the License.
19 
20 /// \file time.hpp
21 /// \brief Basic time operations
22 
23 #ifndef VISIONCPP_INCLUDE_FRAMEWORK_TOOLS_TIME_HPP_
24 #define VISIONCPP_INCLUDE_FRAMEWORK_TOOLS_TIME_HPP_
25 
26 #include <chrono>
27 
28 namespace visioncpp {
29 namespace internal {
30 namespace tools {
31 /// function get_elapse_time
32 /// \brief it is used to calculate the time period in second.
33 /// template parameters
34 /// \tparam T : the type of the time from chrono
35 /// function parameters
36 /// \param begin : start of the time
37 /// \param end : end of the time
38 /// returns a double
39 template <typename T>
40 double get_elapse_time(T begin, T end) {
41  return std::chrono::duration<double, std::chrono::seconds::period>(
42  end - begin).count();
43 };
44 /// function get_current_time
45 /// \brief getting the current time from the system using chrono
46 /// \return std::chrono::high_resolution_clock::time_point
47 std::chrono::high_resolution_clock::time_point get_current_time() {
48  return std::chrono::high_resolution_clock::now();
49 }
50 } // tools
51 } // internal
52 } // visioncpp
53 #endif // VISIONCPP_INCLUDE_FRAMEWORK_TOOLS_TIME_HPP_
double get_elapse_time(T begin, T end)
function get_elapse_time
Definition: time.hpp:40
std::chrono::high_resolution_clock::time_point get_current_time()
function get_current_time
Definition: time.hpp:47
VisionCpp namespace.
Definition: sycl/device.hpp:24