unixtime.h 812 B

123456789101112131415161718192021222324252627282930313233
  1. // This file is part of Desktop App Toolkit,
  2. // a set of libraries for developing nice desktop applications.
  3. //
  4. // For license and copyright information please follow this link:
  5. // https://github.com/desktop-app/legal/blob/master/LEGAL
  6. //
  7. #pragma once
  8. #include "base/basic_types.h"
  9. class QDateTime;
  10. namespace base {
  11. namespace unixtime {
  12. // All functions are thread-safe.
  13. [[nodiscard]] TimeId now();
  14. void update(TimeId now, bool force = false);
  15. [[nodiscard]] rpl::producer<> updates(); // main thread
  16. [[nodiscard]] QDateTime parse(TimeId value);
  17. [[nodiscard]] TimeId serialize(const QDateTime &date);
  18. [[nodiscard]] bool http_valid();
  19. [[nodiscard]] TimeId http_now();
  20. void http_update(TimeId now);
  21. void http_invalidate();
  22. [[nodiscard]] uint64 mtproto_msg_id();
  23. } // namespace unixtime
  24. } // namespace base