time.h
Go to the documentation of this file.
1 /*
2  * This file is a part of TiledArray.
3  * Copyright (C) 2019 Virginia Tech
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Eduard Valeyev
19  * Department of Chemistry, Virginia Tech
20  *
21  * util/time.h
22  * Oct 24, 2019
23  *
24  */
25 
26 #ifndef TILEDARRAY_UTIL_TIME_H__INCLUDED
27 #define TILEDARRAY_UTIL_TIME_H__INCLUDED
28 
29 #include <chrono>
30 
31 namespace TiledArray {
32 
34 
36 
39 }
40 
41 inline double duration_in_s(time_point const &t0, time_point const &t1) {
42  return std::chrono::duration<double>{t1 - t0}.count();
43 }
44 
45 inline int64_t duration_in_ns(time_point const &t0, time_point const &t1) {
46  return std::chrono::duration_cast<std::chrono::nanoseconds>(t1 - t0).count();
47 }
48 
49 } // namespace TiledArray
50 
51 #endif // TILEDARRAY_UTIL_TIME_H__INCLUDED
int64_t duration_in_ns(time_point const &t0, time_point const &t1)
Definition: time.h:45
double duration_in_s(time_point const &t0, time_point const &t1)
Definition: time.h:41
time_point now()
Definition: time.h:35
std::chrono::system_clock::time_point system_now()
Definition: time.h:37
std::chrono::high_resolution_clock::time_point time_point
Definition: time.h:33