member-timestamp: Timestamps are in seconds

We provide timestamps in seconds but they are treated as milliseconds so
the formatted date and time are wrong
This commit is contained in:
Kévin Commaille 2023-11-09 09:55:23 +01:00
parent 3c50632c9e
commit af8469d1f8
No known key found for this signature in database
GPG key ID: 29A48C1F03620416

View file

@ -17,7 +17,7 @@ mod imp {
pub struct MemberTimestamp { pub struct MemberTimestamp {
/// The room member. /// The room member.
pub member: glib::WeakRef<Member>, pub member: glib::WeakRef<Member>,
/// The timestamp, in milliseconds since Unix Epoch. /// The timestamp, in seconds since Unix Epoch.
/// ///
/// A value of 0 means no timestamp. /// A value of 0 means no timestamp.
pub timestamp: Cell<u64>, pub timestamp: Cell<u64>,
@ -102,7 +102,7 @@ impl MemberTimestamp {
self.notify("member"); self.notify("member");
} }
/// The timestamp of this read receipt, in milliseconds since Unix Epoch, if /// The timestamp of this read receipt, in seconds since Unix Epoch, if
/// any. /// any.
/// ///
/// A value of 0 means no timestamp. /// A value of 0 means no timestamp.
@ -129,7 +129,7 @@ impl MemberTimestamp {
return String::new(); return String::new();
} }
let datetime = glib::DateTime::from_unix_utc((timestamp / 1000) as i64) let datetime = glib::DateTime::from_unix_utc(timestamp as i64)
.and_then(|t| t.to_local()) .and_then(|t| t.to_local())
.unwrap(); .unwrap();