Skip to content

Commit

Permalink
Merge pull request #673 from uuid-rs/chore/hard-deprecation
Browse files Browse the repository at this point in the history
Hard deprecate Timestamp::to_unix_nanos
  • Loading branch information
KodrAus authored May 15, 2023
2 parents 6d22d0c + 147d4b3 commit 534691e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ jobs:
strategy:
matrix:
exclude:
- os: macos-10.15
- os: macos-latest
rust_target: x86_64-gnu
- os: macos-10.15
- os: macos-latest
rust_target: x86_64-msvc
- os: windows-2019
- os: windows-latest
rust_target: x86_64-apple-darwin
- os: ubuntu-20.04
- os: ubuntu-latest
rust_target: x86_64-msvc
- os: ubuntu-20.04
- os: ubuntu-latest
rust_target: x86_64-apple-darwin
channel:
- stable
- beta
- nightly
os:
- macos-10.15
- ubuntu-20.04
- windows-2019
- macos-latest
- ubuntu-latest
- windows-latest
rust_target:
- x86_64-gnu
- x86_64-msvc
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:

stable:
name: "Tests / Stable"
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
Expand All @@ -79,7 +79,7 @@ jobs:

msrv:
name: "Tests / MSRV"
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
Expand Down
10 changes: 2 additions & 8 deletions src/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,14 @@ impl Timestamp {
)
}

#[deprecated(note = "use `to_unix` instead")]
#[deprecated(note = "use `to_unix` instead; this method will be removed in a future release")]
/// Get the number of fractional nanoseconds in the Unix timestamp.
///
/// This method is deprecated and probably doesn't do what you're expecting it to.
/// It doesn't return the timestamp as nanoseconds since the Unix epoch, it returns
/// the fractional seconds of the timestamp.
pub const fn to_unix_nanos(&self) -> u32 {
// NOTE: This method never did what it said on the tin: instead of
// converting the timestamp into nanos it simply returned the nanoseconds
// part of the timestamp.
//
// We can't fix the behavior because the return type is too small to fit
// a useful value for nanoseconds since the epoch.
self.nanos
panic!("`Timestamp::to_unix_nanos` is deprecated and will be removed: use `Timestamp::to_unix` instead")
}
}

Expand Down

0 comments on commit 534691e

Please sign in to comment.