Skip to content

Commit 240b44f

Browse files
committed
Switch cargo_registry_s3 to use chrono instead of time
The old code used the local time which I've switched to Utc. Otherwise the 822z and 2822 format appear the same.
1 parent fcf845c commit 240b44f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/s3/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ path = "lib.rs"
1414

1515
[dependencies]
1616
openssl = "0.9"
17-
time = "0.1.0"
17+
chrono = "0.4"
1818
curl = "0.4"
1919
base64 = "0.6"

src/s3/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
extern crate base64;
44
extern crate curl;
55
extern crate openssl;
6-
extern crate time;
6+
extern crate chrono;
77

88
use std::io::prelude::*;
99

10+
use chrono::prelude::Utc;
1011
use curl::easy::{Easy, List, ReadError, Transfer};
1112
use openssl::hash::MessageDigest;
1213
use openssl::sign::Signer;
@@ -53,7 +54,7 @@ impl Bucket {
5354
path
5455
};
5556
let host = self.host();
56-
let date = time::now().rfc822z().to_string();
57+
let date = Utc::now().to_rfc2822().to_string();
5758
let auth = self.auth("PUT", &date, path, "", content_type);
5859
let url = format!("{}://{}/{}", self.proto, host, path);
5960

@@ -91,7 +92,7 @@ impl Bucket {
9192
path
9293
};
9394
let host = self.host();
94-
let date = time::now().rfc822z().to_string();
95+
let date = Utc::now().to_rfc2822().to_string();
9596
let auth = self.auth("DELETE", &date, path, "", "");
9697
let url = format!("{}://{}/{}", self.proto, host, path);
9798

0 commit comments

Comments
 (0)