TimeProvider.h 706 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef TIMEPROVIDER_H
  2. #define TIMEPROVIDER_H
  3. #include <vector>
  4. #include <stdint.h>
  5. class TimeProvider
  6. {
  7. private:
  8. unsigned long long timestampDiff;
  9. public:
  10. /**
  11. * @brief Bypasses the need for NTP server sync by syncing with spotify's servers
  12. *
  13. */
  14. TimeProvider();
  15. /**
  16. * @brief Syncs the TimeProvider with spotify server's timestamp
  17. *
  18. * @param pongPacket pong packet containing timestamp
  19. */
  20. void syncWithPingPacket(const std::vector<uint8_t>& pongPacket);
  21. /**
  22. * @brief Get current timestamp synced with spotify servers
  23. *
  24. * @return unsigned long long timestamp
  25. */
  26. unsigned long long getSyncedTimestamp();
  27. };
  28. #endif