Skip to content

Commit 04fb8cc

Browse files
committed
1 parent d05ff55 commit 04fb8cc

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

Cargo.lock

+8-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ time = "0.3.17"
8686
indoc = "2.0.0"
8787
pretty_assertions = "1.3.0"
8888
rustversion = "1.0.9"
89+
time = { version = "0.3.17", features = ["macros"] }
8990
trycmd = "0.14.0"
9091

9192
[features]

src/module_writer.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ use std::path::{Path, PathBuf};
2727
use std::process::{Command, Output};
2828
use std::str;
2929
use tempfile::{tempdir, TempDir};
30-
use time::macros::datetime;
31-
use time::OffsetDateTime;
3230
use tracing::debug;
3331
use zip::{self, DateTime, ZipWriter};
3432

@@ -331,11 +329,14 @@ impl WheelWriter {
331329
/// Note that the earliest timestamp a zip file can represent is 1980-01-01
332330
fn mtime(&self) -> Result<DateTime> {
333331
let epoch: i64 = env::var("SOURCE_DATE_EPOCH")?.parse()?;
334-
let dt = OffsetDateTime::from_unix_timestamp(epoch)?;
335-
let min_dt = datetime!(1980-01-01 0:00 UTC);
332+
let dt = time::OffsetDateTime::from_unix_timestamp(epoch)?;
333+
let min_dt = time::Date::from_calendar_date(1980, time::Month::January, 1)
334+
.unwrap()
335+
.midnight()
336+
.assume_offset(time::UtcOffset::UTC);
336337
let dt = dt.max(min_dt);
337338

338-
let dt = DateTime::from_time(dt).map_err(|_| anyhow!("Failed to build zip DateTime"))?;
339+
let dt = DateTime::try_from(dt).map_err(|_| anyhow!("Failed to build zip DateTime"))?;
339340
Ok(dt)
340341
}
341342

0 commit comments

Comments
 (0)