Recast  1
Game with custom magic
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
TimeUtils.hpp
Go to the documentation of this file.
1 //
2 // Created by Oleg Morozenkov on 08.05.17.
3 //
4 
5 #ifndef RECAST_TIMEUTILS_H
6 #define RECAST_TIMEUTILS_H
7 
8 
9 #include <chrono>
10 
14 namespace TimeUtils {
15 
21  inline long long int currentTimeMillis() {
22  const auto now = std::chrono::system_clock::now();
23  const auto duration = now.time_since_epoch();
24  const auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
25  return millis;
26  }
27 
33  inline double currentTimeSeconds() {
34  return (double) currentTimeMillis() / 1000;
35  }
36 
37 };
38 
39 #endif //RECAST_TIMEUTILS_H
long long int currentTimeMillis()
Definition: TimeUtils.hpp:21
double currentTimeSeconds()
Definition: TimeUtils.hpp:33