Use UTC timestamps - #868
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates timestamp generation throughout the codebase to use UTC timestamps instead of local time. The change replaces DateTime.now() with DateTime.timestamp() to ensure consistent UTC-based time handling across the application.
Key changes:
- Replaced all instances of
DateTime.now()withDateTime.timestamp()for UTC consistency - Updated import statements to be more specific by using
showclauses - Modified one instance to reuse an already computed timestamp value instead of creating a new one
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| web/e2ee.sfi_guard.dart | Updated SIF frame timing calculations to use UTC timestamps |
| lib/src/support/region_url_provider.dart | Updated region settings cache timing to use UTC timestamps |
| lib/src/participant/participant.dart | Updated participant speaking and join time tracking to use UTC timestamps |
| lib/src/participant/local.dart | Updated data stream timestamps and optimized timestamp reuse |
| lib/src/core/signal_client.dart | Updated ping timestamps to use UTC |
| lib/src/core/room.dart | Updated transcription and data stream timing to use UTC |
| lib/src/core/engine.dart | Updated reconnection timing to use UTC |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| topic: options?.topic, | ||
| encryptionType: options?.encryptionType, | ||
| timestamp: Int64(DateTime.now().millisecondsSinceEpoch), | ||
| timestamp: Int64(info.timestamp), |
There was a problem hiding this comment.
This change improves maintainability by reusing the timestamp from info instead of generating a new timestamp with DateTime.timestamp().millisecondsSinceEpoch. This ensures consistency between the timestamp stored in info and the one used in the protocol buffer.
The timestamp() constructor uses now() + UTC.