Skip to content

Commit

Permalink
Merge branch 'master' into 4.0.0-dev-gh-237
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherRabotin committed Apr 6, 2024
2 parents 569d0a7 + c28151d commit 6a26880
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 15 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ jobs:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
check-latest: false
allow-prereleases: false
- name: Remove bad python
run: ls -l `which python`; ls -l /usr/bin/python*
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand Down Expand Up @@ -85,7 +89,7 @@ jobs:
target: [x64, x86]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: ${{ matrix.target }}
Expand Down Expand Up @@ -116,7 +120,7 @@ jobs:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build wheels
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust:
- { version: "1.70", name: MSRV }
- { version: "1.74", name: MSRV }
- { version: stable, name: stable }

runs-on: ${{ matrix.os }}
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ name = "hifitime"
serde = { version = "1.0.155", optional = true }
serde_derive = { version = "1.0.155", optional = true }
der = { version = "0.7.8", features = ["derive", "real"], optional = true }
pyo3 = { version = "0.20.0", features = ["extension-module"], optional = true }
pyo3 = { version = "0.21.1", features = ["extension-module"], optional = true }
num-traits = { version = "0.2.15", default-features = false, features = [
"libm",
] }
lexical-core = { version = "0.8.5", default-features = false, features = [
"parse-integers",
"parse-floats",
] }
reqwest = { version = "0.11", features = ["blocking", "json"], optional = true }
reqwest = { version = "0.12", features = ["blocking", "json"], optional = true }
tabled = { version = "0.15.0", optional = true }
openssl = { version = "0.10", features = ["vendored"], optional = true }
web-time = { version = "1.0.0", optional = true }
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,11 @@ In order to provide full interoperability with NAIF, hifitime uses the NAIF algo

# Changelog

## 3.9.0 (WIP)
## 4.0.0 (WIP)

+ Minimum Support Rust Version bumped to 1.74.0

## 3.9.0

+ Update to der version 0.7.x.
+ Introduce %y formatter by @gwbres in https://github.com/nyx-space/hifitime/pull/268
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=1.3,<1.4"]
requires = ["maturin>=1.5,<1.6"]
build-backend = "maturin"

[project]
Expand Down
5 changes: 4 additions & 1 deletion src/efmt/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ impl Format {
// Previous index of interest in the string
let mut prev_idx = 0;
let mut cur_item_idx = 0;
let mut cur_item = self.items[cur_item_idx].unwrap();
let mut cur_item = match self.items[cur_item_idx] {
Some(item) => item,
None => return Err(Errors::ParseError(ParsingErrors::UnknownFormat)),
};
let mut cur_token = cur_item.token;
let mut prev_item = cur_item;
let mut prev_token;
Expand Down
13 changes: 11 additions & 2 deletions src/epoch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,13 @@ impl Epoch {
return Err(Errors::Carry);
}

let years_since_ref = year - time_scale.ref_year();
let mut duration_wrt_ref = Unit::Day * i64::from(365 * years_since_ref);
let mut duration_wrt_ref = match year.checked_sub(time_scale.ref_year()) {
None => return Err(Errors::Overflow),
Some(years_since_ref) => match years_since_ref.checked_mul(365) {
None => return Err(Errors::Overflow),
Some(days) => Unit::Day * i64::from(days),
},
};

// Now add the leap days for all the years prior to the current year
if year >= time_scale.ref_year() {
Expand Down Expand Up @@ -1145,6 +1150,10 @@ impl Epoch {
idx + 1
};

if prev_idx > end_idx {
return Err(Errors::ParseError(ParsingErrors::ISO8601));
}

match lexical_core::parse(s[prev_idx..end_idx].as_bytes()) {
Ok(val) => {
// Check that this valid is OK for the token we're reading it as.
Expand Down
5 changes: 1 addition & 4 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ impl fmt::Display for Errors {
Self::ConversionOverlapError(hi, lo) => {
write!(f, "hi and lo values overlap: {}, {}", hi, lo)
}
Self::Overflow => write!(
f,
"overflow occurred when trying to convert Duration information"
),
Self::Overflow => write!(f, "prevented overflow/underflow"),
Self::SystemTimeError => write!(f, "std::time::SystemTime returned an error"),
}
}
Expand Down

0 comments on commit 6a26880

Please sign in to comment.