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

Change: Drop parsing of $Date #1552

Merged
merged 4 commits into from
Jan 25, 2024
Merged
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
8 changes: 3 additions & 5 deletions rust/storage/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ impl AsUnixTimeStamp for String {
impl AsUnixTimeStamp for &str {
fn as_timestamp(&self) -> Option<i64> {
let to_parse = {
// transforms `$Date: wanted (....) $` to wanted
self.splitn(2, "$Date: ")
.filter_map(|x| x.split(" $").next())
.filter_map(|x| x.split(" (").next())
// transforms `wanted (....)` to wanted
self.splitn(2, " (")
.find(|x| !x.is_empty())
.unwrap_or_default()
};
Expand All @@ -60,7 +58,7 @@ mod tests {

#[test]
fn date_string() {
let example = "$Date: 2018-09-07 11:08:31 +0200 (Fri, 07 Sep 2018) $";
let example = "2018-09-07 11:08:31 +0200 (Fri, 07 Sep 2018)";
assert_eq!(example.as_timestamp(), Some(1536311311));
}

Expand Down
Loading