Explorar o código

wallet: chatview switch timestamp from millis to secs

darkfi %!s(int64=2) %!d(string=hai) anos
pai
achega
62b2cd6276
Modificáronse 2 ficheiros con 3 adicións e 3 borrados
  1. 1 1
      bin/darkwallet/src/app.rs
  2. 2 2
      bin/darkwallet/src/ui/chatview.rs

+ 1 - 1
bin/darkwallet/src/app.rs

@@ -754,7 +754,7 @@ fn populate_tree(tree: &sled::Tree) {
         let min = min.parse::<u32>().unwrap();
         let dt: NaiveDateTime =
             NaiveDate::from_ymd_opt(2024, 8, 6).unwrap().and_hms_opt(hour, min, 0).unwrap();
-        let timest = dt.and_utc().timestamp_millis() as u64;
+        let timest = dt.and_utc().timestamp() as u64;
 
         let message_id = [0u8; 32];
         let nick = parts[1].to_string();

+ 2 - 2
bin/darkwallet/src/ui/chatview.rs

@@ -639,7 +639,7 @@ impl ChatView {
 
         let chatmsg = ChatMsg { nick, text };
 
-        let dt = Local.timestamp_millis_opt(timest as i64).unwrap();
+        let dt = Local.timestamp_opt(timest as i64, 0).unwrap();
         let timestr = dt.format("%H:%M").to_string();
 
         let text = format!("{} {} {}", timestr, chatmsg.nick, chatmsg.text);
@@ -822,7 +822,7 @@ impl ChatView {
             let chatmsg: ChatMsg = deserialize(&v).unwrap();
             debug!(target: "ui::chatview", "{timest:?} {chatmsg:?}");
 
-            let dt = Local.timestamp_millis_opt(timest as i64).unwrap();
+            let dt = Local.timestamp_opt(timest as i64, 0).unwrap();
             let timestr = dt.format("%H:%M").to_string();
 
             let text = format!("{} {} {}", timestr, chatmsg.nick, chatmsg.text);