diff --git a/libs/chat/src/api.rs b/libs/chat/src/api.rs index aff4d587f..ad09434e9 100644 --- a/libs/chat/src/api.rs +++ b/libs/chat/src/api.rs @@ -35,7 +35,7 @@ pub const POST_TEXT_MAX: usize = 3072; #[derive(Archive, Serialize, Deserialize, Debug)] pub struct Find { pub author: xous_ipc::String<128>, - pub timestamp: u32, + pub timestamp: u64, pub key: Option, // the return post key if found. } @@ -48,7 +48,7 @@ pub struct Dialogue { #[derive(Archive, Serialize, Deserialize, Debug)] pub struct Post { pub author: xous_ipc::String<128>, - pub timestamp: u32, + pub timestamp: u64, pub text: xous_ipc::String, pub attach_url: Option>, } diff --git a/libs/chat/src/dialogue.rs b/libs/chat/src/dialogue.rs index 0fc4f8752..8ae575889 100644 --- a/libs/chat/src/dialogue.rs +++ b/libs/chat/src/dialogue.rs @@ -21,7 +21,7 @@ pub struct Dialogue { posts: Vec, authors: HashMap, author_lookup: HashMap, - last_timestamp: u32, + last_timestamp: u64, last_author_id: u16, } @@ -48,7 +48,7 @@ impl Dialogue { pub fn post_add( &mut self, author: &str, - timestamp: u32, + timestamp: u64, text: &str, _attach_url: Option<&str>, ) -> Result<(), Error> { @@ -82,7 +82,7 @@ impl Dialogue { } } - pub fn post_find(&self, author: &str, timestamp: u32) -> Option { + pub fn post_find(&self, author: &str, timestamp: u64) -> Option { if let Some(author_id) = self.author_lookup.get(author) { match self .posts diff --git a/libs/chat/src/dialogue/post.rs b/libs/chat/src/dialogue/post.rs index 225c7849b..0240ea68f 100644 --- a/libs/chat/src/dialogue/post.rs +++ b/libs/chat/src/dialogue/post.rs @@ -7,7 +7,7 @@ use rkyv::{Archive, Deserialize, Serialize}; #[derive(Archive, Serialize, Deserialize, Debug)] pub struct Post { author_id: u16, - timestamp: u32, + timestamp: u64, text: String, attach: Option, pub flags: u16, @@ -15,7 +15,7 @@ pub struct Post { #[allow(dead_code)] impl Post { - pub fn new(author_id: u16, timestamp: u32, text: &str, attach: Option) -> Self { + pub fn new(author_id: u16, timestamp: u64, text: &str, attach: Option) -> Self { Self { author_id: author_id, timestamp: timestamp, @@ -45,7 +45,7 @@ impl Post { self.text.as_str() } - pub fn timestamp(&self) -> u32 { + pub fn timestamp(&self) -> u64 { self.timestamp } } diff --git a/libs/chat/src/lib.rs b/libs/chat/src/lib.rs index fb05ccf5f..da89911ab 100644 --- a/libs/chat/src/lib.rs +++ b/libs/chat/src/lib.rs @@ -62,7 +62,7 @@ impl Chat { pub fn post_add( &self, author: &str, - timestamp: u32, + timestamp: u64, text: &str, attach_url: Option<&str>, ) -> Result<(), Error> { @@ -90,7 +90,7 @@ impl Chat { } // get a Post from the current Dialogue - pub fn post_find(&self, author: &str, timestamp: u32) -> Result, Error> { + pub fn post_find(&self, author: &str, timestamp: u64) -> Result, Error> { let mut find = Find { author: xous_ipc::String::new(), timestamp: timestamp, @@ -266,7 +266,7 @@ pub fn server( xous::terminate_process(0) } -pub fn now() -> u32 { +pub fn now() -> u64 { SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap() diff --git a/libs/chat/src/ui.rs b/libs/chat/src/ui.rs index f19de62a6..513a6e773 100644 --- a/libs/chat/src/ui.rs +++ b/libs/chat/src/ui.rs @@ -238,7 +238,7 @@ impl Ui { pub fn post_add( &mut self, author: &str, - timestamp: u32, + timestamp: u64, text: &str, attach_url: Option<&str>, ) -> Result<(), Error> { @@ -264,7 +264,7 @@ impl Ui { } // get a Post from the current Dialogue - pub fn post_find(&self, author: &str, timestamp: u32) -> Option { + pub fn post_find(&self, author: &str, timestamp: u64) -> Option { match &self.dialogue { Some(dialogue) => dialogue.post_find(author, timestamp), None => None,