Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace chrono with time crate #13

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ license = "MIT/Apache-2.0"

[dependencies]
once_cell = "1.13.0"
chrono = "0.4.20"

[dependencies.time]
version = "0.3"
features = ["parsing"]

[dependencies.arcdps_codegen]
version = "0.9.0"
Expand Down
4 changes: 3 additions & 1 deletion core/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ pub fn convert_extras_user(user: &RawUserInfo) -> UserInfo {
#[inline(always)]
pub fn convert_extras_chat_message(msg: &RawChatMessageInfo) -> ChatMessageInfo {
let timestamp = unsafe { get_str_from_ptr_and_len(msg.timestamp, msg.timestamp_length) };
let timestamp = chrono::DateTime::parse_from_rfc3339(timestamp).unwrap();
let timestamp =
time::OffsetDateTime::parse(timestamp, &time::format_description::well_known::Rfc3339)
.unwrap();

let account_name =
unsafe { get_str_from_ptr_and_len(msg.account_name, msg.account_name_length) };
Expand Down
4 changes: 2 additions & 2 deletions core/src/unofficial_extras/raw_structs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Generated against hash 83db782 of unofficial_extras_releases

use chrono::{DateTime, FixedOffset};
use time::OffsetDateTime;

use crate::{raw_structs::HMODULE, unofficial_extras::raw_structs_keybinds};

Expand Down Expand Up @@ -165,7 +165,7 @@ pub struct ChatMessageInfo<'a> {
/// potentially differ several seconds between the client and server because
/// of latency and clock skew. The string is only valid for the duration of
/// the call.
pub timestamp: DateTime<FixedOffset>,
pub timestamp: OffsetDateTime,

/// Null terminated account name of the player that sent the message,
/// including leading ':'. The string is only valid for the duration of the
Expand Down