Util.cpp 383 B

1234567891011121314151617181920212223
  1. #include "Util.h"
  2. #include <algorithm>
  3. #include <ctime>
  4. namespace DataStorageInterface {
  5. namespace Util {
  6. int GetTimestamp()
  7. {
  8. return std::time(nullptr);
  9. }
  10. int GetUTCOffset()
  11. {
  12. std::time_t current_time;
  13. std::time(&current_time);
  14. struct std::tm *timeinfo = std::localtime(&current_time);
  15. return timeinfo->tm_gmtoff;
  16. }
  17. } // namespace Util
  18. } // namespace DataStorageInterface