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

4.0.0 dev gh 237 #289

Merged
merged 68 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c8648ef
epoch::from_duration slight improvements
gwbres May 27, 2023
0062d93
rename epoch inner duration
gwbres May 28, 2023
b6580ea
introducing to_time_scale
gwbres May 28, 2023
5de034b
introducing week unit
gwbres May 28, 2023
9d0afbd
fix eq and comparison issue: compare in same time scale
gwbres May 28, 2023
7ffad08
Update src/epoch.rs
gwbres May 30, 2023
e477272
Update src/epoch.rs
gwbres May 30, 2023
17f0568
working on compute_gregorian()
gwbres May 30, 2023
6df531a
Fixed unit tests
ChristopherRabotin Jun 12, 2023
c6218ef
Spread out duration.rs into a module
ChristopherRabotin Jun 12, 2023
846418e
Merge branch '4.0.0-dev' into 4.0.0-dev-gh-237
ChristopherRabotin Jun 12, 2023
0885a42
Modicum of progress but TDB/ET conversions are broken
ChristopherRabotin Jun 16, 2023
ac709df
Progress in time scale conversion with new arch
ChristopherRabotin Jun 17, 2023
e70be45
Also convert the time scale with leap seconds into the one without le…
ChristopherRabotin Jun 17, 2023
5c4a2eb
Fix gregorian computation with new arch
ChristopherRabotin Jun 17, 2023
fb0e809
Might have found a bug in duration decompose
ChristopherRabotin Jun 17, 2023
3606ef6
Fix decompose in duration
ChristopherRabotin Jun 17, 2023
53d6ca5
Replace references to `self.duration` to ensure TAI conversion
ChristopherRabotin Jun 17, 2023
5899c93
Likely bug to be fixed
ChristopherRabotin Jun 17, 2023
faa31cc
add more tests
Sep 2, 2023
8e19bfa
improve to_time_scale, initial_year..
Sep 2, 2023
d1e6236
on the right track..
Sep 2, 2023
ce02a28
on the right track..
Sep 2, 2023
a225d8d
working on tai_utc
Sep 2, 2023
7e10d82
working on tai_utc
Sep 2, 2023
e95b519
working on tai_utc
Sep 2, 2023
324c676
working on tai_utc
Sep 2, 2023
295f46f
change print behavior
Sep 2, 2023
52fec8f
revert to_time_scale()
Sep 3, 2023
233d449
time_scale.decompose()
Sep 3, 2023
75350b1
revert from_gregorian and compute_gregorian
Sep 3, 2023
88e544d
revert to previously almost correct gregorian
Sep 3, 2023
49c2a23
Modify Epoch.debug() behavior
Sep 18, 2023
f47d416
modify PartialEq behavior
Sep 29, 2023
97ad926
reduce indentation
gwbres Sep 29, 2023
451c29a
...
gwbres Sep 29, 2023
7f6441e
...
gwbres Sep 29, 2023
729160d
fix to_bdt_duration
gwbres Sep 30, 2023
fff0c95
Revert recent changes, will compare
ChristopherRabotin Mar 3, 2024
dad52e0
Start working on #282
ChristopherRabotin Mar 29, 2024
997957f
Fix merge conflicts with master (still one more left)
ChristopherRabotin Mar 29, 2024
1e15ddf
Update duration
ChristopherRabotin Mar 29, 2024
569d0a7
Merge branch 'master' into 4.0.0-dev-gh-237
ChristopherRabotin Mar 29, 2024
6a26880
Merge branch 'master' into 4.0.0-dev-gh-237
ChristopherRabotin Apr 6, 2024
d29c3cd
Fix formatting of time scales if ref hour is != 0
ChristopherRabotin Apr 7, 2024
fe5a79f
Only 36524 days in the 20th century
ChristopherRabotin Apr 7, 2024
a0e0b47
Fixed spice_et_tdb test
ChristopherRabotin Apr 8, 2024
b63a5e6
Fixed test_from_str
ChristopherRabotin Apr 8, 2024
5ac34a2
Fix ref year of TT
ChristopherRabotin Apr 16, 2024
88d74c7
Fixed where the time scale ref hour is applied
ChristopherRabotin Apr 17, 2024
2b98298
Fixed ref hour correction in formatting for ET and TDB
ChristopherRabotin Apr 17, 2024
a2df9ed
Merge branch 'master' into 4.0.0-dev-gh-237
ChristopherRabotin Apr 17, 2024
09428c5
Replace ref_hour and ref_year by the prime epoch difference
ChristopherRabotin Apr 19, 2024
57c979f
Ensure that durations are normalized before adding or subtracting
ChristopherRabotin Apr 20, 2024
02296e7
Fix documentation for test_days_et_j2000
ChristopherRabotin Apr 20, 2024
20e2186
Add `subdivision` to Duration and gregorian_epoch_offset which is the…
ChristopherRabotin Apr 21, 2024
e89bd04
Disabled test_timescale_leapsec test -- I don't think it's relevant
ChristopherRabotin Apr 23, 2024
c2a0d21
Fix doc test
ChristopherRabotin Apr 23, 2024
6351f4f
Update readme
ChristopherRabotin Apr 23, 2024
a13aff5
Update Python bindings to 0.21
ChristopherRabotin Apr 23, 2024
1a3b0af
Fix UT1
ChristopherRabotin Apr 23, 2024
51f59fa
Fix no-std builds and update MSRV
ChristopherRabotin Apr 23, 2024
a946d0e
Fix kani
ChristopherRabotin Apr 23, 2024
cc32ec7
Fix kani + switch to -alpha for pip
ChristopherRabotin Apr 23, 2024
ffed960
Adding no-index and verbose for pip
ChristopherRabotin Apr 23, 2024
acbe57c
Try to fix aarch64 python
ChristopherRabotin Apr 23, 2024
db26d2c
Update artifact action for warning
ChristopherRabotin Apr 23, 2024
6139ecc
Revert to artifacts v3
ChristopherRabotin Apr 23, 2024
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: 4 additions & 4 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
Expand All @@ -36,7 +36,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
Expand All @@ -57,7 +57,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
Expand All @@ -78,7 +78,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/formal_verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
continue-on-error: true
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Clean Cargo.toml for Kani
run: |
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ jobs:
matrix:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@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 @@ -63,7 +61,8 @@ jobs:
shell: bash
run: |
set -e
pip install hifitime --find-links dist --force-reinstall
ls dist
pip install hifitime --find-links dist --force-reinstall --no-index -vv
pip install pytest
pytest
- name: pytest
Expand All @@ -79,7 +78,8 @@ jobs:
pip3 install -U pip pytest
run: |
set -e
pip3 install hifitime --find-links dist --force-reinstall
ls dist
pip3 install hifitime --find-links dist --force-reinstall --no-index -vv
pytest

windows:
Expand All @@ -88,7 +88,7 @@ jobs:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
Expand All @@ -109,7 +109,7 @@ jobs:
shell: bash
run: |
set -e
pip install hifitime --find-links dist --force-reinstall
pip install hifitime --find-links dist --force-reinstall --no-index -vv
pip install pytest
pytest

Expand All @@ -119,7 +119,7 @@ jobs:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
Expand All @@ -139,14 +139,14 @@ jobs:
shell: bash
run: |
set -e
pip install hifitime --find-links dist --force-reinstall
pip install hifitime --find-links dist --force-reinstall --no-index -vv
pip install pytest
pytest

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
Expand All @@ -33,14 +33,14 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust:
- { version: "1.74", name: MSRV }
- { version: "1.77", name: MSRV }
- { version: stable, name: stable }

runs-on: ${{ matrix.os }}
name: Test Suite (${{ matrix.os }}, ${{ matrix.rust.name }})
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install ${{ matrix.rust.name }} toolchain
uses: dtolnay/rust-toolchain@master
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@master
Expand All @@ -86,12 +86,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.64 # Run lints using the MSRV not latest
toolchain: 1.77
components: rustfmt, clippy

- name: Run cargo fmt
Expand All @@ -106,7 +106,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
Expand All @@ -127,7 +127,7 @@ jobs:
RUSTFLAGS: --cfg __ui_tests

- name: Upload coverage report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: ./lcov.txt

Expand All @@ -138,7 +138,7 @@ jobs:
if: github.ref_type == 'tag'
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
Cargo.lock
.env
.venv
dist/
dist/
.venv
src/epoch.rs
.vscode/settings.json
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hifitime"
version = "4.0.0-dev"
version = "4.0.0-alpha"
authors = ["Christopher Rabotin <[email protected]>"]
description = "Ultra-precise date and time handling in Rust for scientific applications with leap second support"
homepage = "https://nyxspace.com/"
Expand All @@ -21,7 +21,10 @@ 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.21.1", features = ["extension-module"], optional = true }
pyo3 = { version = "0.21.1", features = [
"extension-module",
"inventory",
], optional = true }
num-traits = { version = "0.2.15", default-features = false, features = [
"libm",
] }
Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ let example_now = Epoch::from_gregorian_utc_hms(2015, 8, 17, 22, 55, 01);

// We'll round to the nearest fifteen days
let this_much_ago = example_now - previous_post;
assert_eq!(format!("{this_much_ago}"), "191 days 11 h 32 min 29 s");
assert_eq!(format!("{this_much_ago}"), "191 days 11 h 32 min 28 s");
let about_this_much_ago_floor = this_much_ago.floor(15.days());
assert_eq!(format!("{about_this_much_ago_floor}"), "180 days");
let about_this_much_ago_ceil = this_much_ago.ceil(15.days());
Expand Down Expand Up @@ -311,7 +311,9 @@ In order to provide full interoperability with NAIF, hifitime uses the NAIF algo

## 4.0.0 (WIP)

+ Minimum Support Rust Version bumped to 1.74.0
+ Minimum Support Rust Version (MSRV) bumped to 1.77.0
+ Major refactoring of the code for ease of maintenance and removal of deprecrated functions from 3.x
+ Centralization of all time scale conversions into the `to_time_scale` function -- huge effort by [@gwbres](https://github.com/gwbres)

## 3.9.0

Expand Down Expand Up @@ -414,3 +416,21 @@ Huge thanks to [@gwbres](https://github.com/gwbres) who put in all of the work f
# Important Update on Versioning Strategy

We want to inform our users of an important change in Hifitime's versioning approach. Starting with version 3.9.0, minor version updates may include changes that could potentially break backward compatibility. While we strive to maintain stability and minimize disruptions, this change allows us to incorporate significant improvements and adapt more swiftly to evolving user needs. We recommend users to carefully review the release notes for each update, even minor ones, to understand any potential impacts on their existing implementations. Our commitment to providing a robust and dynamic time management library remains steadfast, and we believe this change in versioning will better serve the evolving demands of our community.

# Development

Thanks for considering to help out on Hifitime!

For Rust development, `cargo` is all you need, along with build tools for the minimum supported Rust version.

## Python development

First, please install [maturin](https://www.maturin.rs/) and set up a Python virtual environment from which to develop. Also make sure that the package version in Cargo.toml is _greater_ than any published version. For example, if the latest version published on [PyPi](https://pypi.org/project/hifitime/) is 4.0.0-a.0 (for alpha-0), make sure that you change the Cargo.toml file such that you're at least in version `alpha-1`, or the `pip install` will download from PyPi instead of installing from the local folder. To run the Python tests, you must install `pytest` in your virtual environment.

The exact steps should be:

1. Jump into the virtual environment: `source .venv/bin/activate` (e.g.)
1. Make sure pytest is installed: `pip install pytest`
1. Build hifitime specifying the output folder of the Python egg: `maturin build -F python --out dist`
1. Install the egg: `pip install dist/hifitime-4.0.0.dev1-cp311-cp311-linux_x86_64.whl`
1. Run the tests using the environmental pytest: `.venv/bin/pytest`
2 changes: 1 addition & 1 deletion examples/python/basic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
* Hifitime, part of the Nyx Space tools
* Copyright (C) 2023 Christopher Rabotin <[email protected]> et al. (cf. AUTHORS.md)
* Copyright (C) 2023 Christopher Rabotin <[email protected]> et al. (cf. https://github.com/nyx-space/hifitime/graphs/contributors)
* This Source Code Form is subject to the terms of the Apache
* v. 2.0. If a copy of the Apache License was not distributed with this
* file, You can obtain one at https://www.apache.org/licenses/LICENSE-2.0.
Expand Down
2 changes: 1 addition & 1 deletion examples/python/timescales.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
* Hifitime, part of the Nyx Space tools
* Copyright (C) 2023 Christopher Rabotin <[email protected]> et al. (cf. AUTHORS.md)
* Copyright (C) 2023 Christopher Rabotin <[email protected]> et al. (cf. https://github.com/nyx-space/hifitime/graphs/contributors)
* This Source Code Form is subject to the terms of the Apache
* v. 2.0. If a copy of the Apache License was not distributed with this
* file, You can obtain one at https://www.apache.org/licenses/LICENSE-2.0.
Expand Down
10 changes: 5 additions & 5 deletions src/asn1der.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Hifitime, part of the Nyx Space tools
* Copyright (C) 2023 Christopher Rabotin <[email protected]> et al. (cf. AUTHORS.md)
* Copyright (C) 2023 Christopher Rabotin <[email protected]> et al. (cf. https://github.com/nyx-space/hifitime/graphs/contributors)
* This Source Code Form is subject to the terms of the Apache
* v. 2.0. If a copy of the Apache License was not distributed with this
* file, You can obtain one at https://www.apache.org/licenses/LICENSE-2.0.
Expand Down Expand Up @@ -40,14 +40,14 @@ impl<'a> Decode<'a> for Duration {
impl Encode for Epoch {
fn encoded_len(&self) -> der::Result<der::Length> {
let ts: u8 = self.time_scale.into();
ts.encoded_len()? + self.to_duration().encoded_len()?
ts.encoded_len()? + self.duration.encoded_len()?
}

fn encode(&self, encoder: &mut impl Writer) -> der::Result<()> {
let ts: u8 = self.time_scale.into();

ts.encode(encoder)?;
self.to_duration().encode(encoder)
self.duration.encode(encoder)
}
}

Expand Down Expand Up @@ -114,7 +114,7 @@ fn test_encdec() {
TimeScale::QZSST => epoch.to_qzsst_duration(),
};

let e_dur = epoch.to_duration();
let e_dur = epoch.duration;

assert_eq!(e_dur, duration, "{ts:?}");

Expand All @@ -126,7 +126,7 @@ fn test_encdec() {
let encdec_epoch = Epoch::from_der(&buf).unwrap();
// Check that the duration in J1900 TAI is the same
assert_eq!(
encdec_epoch.duration_since_j1900_tai, epoch.duration_since_j1900_tai,
encdec_epoch.duration, epoch.duration,
"Decoded epoch incorrect ({ts:?}):\ngot: {encdec_epoch}\nexp: {epoch}",
);
// Check that the time scale used is preserved
Expand Down
Loading
Loading