Replace chrono with time lib

This commit is contained in:
rishflab 2021-10-05 20:06:25 +11:00
parent 394adb0a4f
commit f91d8ab45c
3 changed files with 2 additions and 4 deletions

1
Cargo.lock generated
View File

@ -4117,7 +4117,6 @@ dependencies = [
"bitcoin", "bitcoin",
"bitcoin-harness", "bitcoin-harness",
"bmrng", "bmrng",
"chrono",
"comfy-table", "comfy-table",
"config", "config",
"conquer-once", "conquer-once",

View File

@ -19,7 +19,6 @@ bdk = "0.10"
big-bytes = "1" big-bytes = "1"
bitcoin = { version = "0.26", features = [ "rand", "use-serde" ] } bitcoin = { version = "0.26", features = [ "rand", "use-serde" ] }
bmrng = "0.5" bmrng = "0.5"
chrono = "0.4"
comfy-table = "4.1.1" comfy-table = "4.1.1"
config = { version = "0.11", default-features = false, features = [ "toml" ] } config = { version = "0.11", default-features = false, features = [ "toml" ] }
conquer-once = "0.3" conquer-once = "0.3"

View File

@ -3,12 +3,12 @@ use crate::monero::Address;
use crate::protocol::{Database, State}; use crate::protocol::{Database, State};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use async_trait::async_trait; use async_trait::async_trait;
use chrono::Utc;
use libp2p::{Multiaddr, PeerId}; use libp2p::{Multiaddr, PeerId};
use sqlx::sqlite::Sqlite; use sqlx::sqlite::Sqlite;
use sqlx::{Pool, SqlitePool}; use sqlx::{Pool, SqlitePool};
use std::path::Path; use std::path::Path;
use std::str::FromStr; use std::str::FromStr;
use time::OffsetDateTime;
use uuid::Uuid; use uuid::Uuid;
pub struct SqliteDatabase { pub struct SqliteDatabase {
@ -171,7 +171,7 @@ impl Database for SqliteDatabase {
async fn insert_latest_state(&self, swap_id: Uuid, state: State) -> Result<()> { async fn insert_latest_state(&self, swap_id: Uuid, state: State) -> Result<()> {
let mut conn = self.pool.acquire().await?; let mut conn = self.pool.acquire().await?;
let entered_at = Utc::now(); let entered_at = OffsetDateTime::now_utc();
let swap_id = swap_id.to_string(); let swap_id = swap_id.to_string();
let swap = serde_json::to_string(&Swap::from(state))?; let swap = serde_json::to_string(&Swap::from(state))?;