summaryrefslogtreecommitdiffstats
path: root/openpgp/src/types/timestamp.rs
AgeCommit message (Collapse)Author
2021-12-13ipc, openpgp: Bump quickcheck to 1.0.3.Nora Widdecke
- Adapt to the new API: - Gen is now a struct, not a Trait, and replaces StdThreadGen. - The rand re-export has been removed. As a consequence, we need our own function to generate an arbitrary value from a range.
2021-12-13openpgp: Fix duration_round_up test.Nora Widdecke
- If the round_up clampes the value to u32::MAX, the precision does not apply. - Closes #784.
2021-11-18openpgp: Use a WASM-friendly SystemTime::now wrapper.Justus Winter
- Fixes #769.
2021-08-27openpgp: Correct links.Nora Widdecke
- Some link targets have moved or were replaced since the link's creation. Make them point to the new location or replacement.
2021-08-27ffi, openpgp: Cleanup links after cargo intraconv.Nora Widdecke
- openpgp: Make broken relative links absolute: - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+packet),\1crate::packet,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+cert),\1crate::cert,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+parse),\1crate::parse,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+policy),\1crate::policy,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+serialize),\1crate::serialize,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+armor),\1crate::armor,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+types),\1crate::types,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!] *(\[`PacketPile`\]):).*$,\1 crate::PacketPile,' {} + - openpgp: Link to PacketParser and Policy structs, not the modules. - ffi: Make links to sequoia_openpgp and sequoia_net absolute - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+sequoia_openpgp),\1sequoia_openpgp,' {} + - find -name "*.rs" -exec sed -i -E 's,^( *//[/!](.*): )((super::)+sequoia_net),\1sequoia_net,' {} +
2021-08-27Convert markdown to intra-doc links.Nora Widdecke
- Apply cargo intraconv.
2021-04-09Lint: Remove redundant closures.Nora Widdecke
- https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
2021-04-09Lint: Remove unnecessary conversions.Nora Widdecke
- https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
2021-04-06openpgp: Fix SystemTime test.Nora Widdecke
- The size of SystemTime is an implementation detail of the standard library and does not give a direct indication whether values larger that i32::MAX will fit in it. - Adjust the test to observe if we are on a system can represent a large value as a SystemTime or not, and assert that the values are clamped correctly.
2021-04-06openpgp: Correct system_time_32_bit test.Daniel Kahn Gillmor
@nwalfield suggested this correction in #697
2021-04-06openpgp: Enable time_t overflow test on other 32-bit platforms.Daniel Kahn Gillmor
on Debian GNU/Linux systems, time_t is 4 octets for i386 (rust calls this platform target_arch "x86"), armel ("arm"), armhf ("arm"), and mipsel ("mips"). I've pulled these arch names from platforms [0]. [0] https://github.com/RustSec/platforms-crate/blob/main/src/target/arch.rs There are likely other platforms that have a 32-bit time_t (and indeed, some variants of 32-bit platforms like musl may have a 64-bit time_t [1]), so this gating mechanism still isn't quite right. But it's an improvement over the status quo of just gating on target_arch = "x86". [1] https://musl.libc.org/time64.html
2021-03-05openpgp: Fix SystemTime from Timestamp on 32bit.Nora Widdecke
- SystemTime's underlying datatype may be only `i32`, e.g. on 32bit Unix. As OpenPGP's timestamp datatype is `u32`, there are timestamps (`i32::MAX + 1` to `u32::MAX`) which are not representable on such systems. - To keep the API stable, instead of making the conversion fallible, clamp those too large values to i32::MAX.
2020-12-15openpgp: Use Feb. 1st instead of Jan. 1st as the cutoff day.Neal H. Walfield
- January 1st is a holiday in much of the world. - When we disable an algorithm, things will almost certainly break somewhere. - Reduce the chance that things break when people are on vacation by using February 1st as the cutoff day instead of January 1st.
2020-12-14openpgp: Add Duration::years.Neal H. Walfield
- Add `Duration::years`. - This function assumes that there are 365.2425 days in a year, which is the average number of days in a year in the Gregorian calendar.
2020-12-14openpgp: Make Duration::seconds a const fn.Neal H. Walfield
- Make `Duration::seconds` a const fn.
2020-12-11openpgp: Standardize fn main() in doctests.Azul
- Avoid the additional `fn f()`.
2020-12-08openpgp: Use parens for assert_send_and_sync!.Azul
2020-12-08openpgp: Ensure public types are Send and Sync.Azul
- See #627.
2020-09-22openpgp: Remove `quickcheck` feature.Wiktor Kwapisiewicz
- Adjust code to test for `cfg(test)` only, - Remove `quickcheck` and `rand` from dependencies so that they stay only in dev-dependencies, - Remove mention of `x-quickcheck` feature from the documentation, - Fixes #545.
2020-08-19openpgp: Rename SubpacketArea::lookup to SubpacketArea::subpacket.Neal H. Walfield
- Make `SubpacketArea::lookup`'s name more consistent with `SubpacketArea::subpackets`, `SubpacketAreas::subpacket`, and `SubpacketAreas::subpackets`.
2020-08-05openpgp: Don't implement Default for the Bitflags types.Justus Winter
- See #525.
2020-08-03openpgp: Change CertBuilder to use a relative expiration time.Neal H. Walfield
- `CertBuilder::set_expiration_time` takes an absolute time. - Most callers use a relative time. - Internally, we need a relative time (that's what the Key Expiration Time packet takes). - Converting the absolute time to a relative time is error prone: should it be relative to the creation time when called or when `CertBuilder` is finalized? - KISS: Change it to just take a relative time. - To better reflect the new semantics, also change the name to `CertBuilder::set_validity_period`.
2020-07-28openpgp: Reimplement the KeyFlags struct using Bitfield.Justus Winter
- This also drops the implementation of PartialOrd since we did not use it in the key selection after all. - Fixes #525.
2020-06-08openpgp: Introduce feature flag for quickcheck.Nora Widdecke
- Make quickcheck dependency optional. - Make quickcheck a dev-dependency for tests. - Fix doctests for - cert::ValidCert::user_attributes, - cert::builder::CertBuilder::add_user_attribute, - cert::revoke::UserAttributeRevocationBuilder - cert::revoke::UserAttributeRevocationBuilder::build. Doctests do not use cfg(test), so we cannot use quickcheck in there.
2020-06-01openpgp: Add doctests to types module.Wiktor Kwapisiewicz
- Fixes #475.
2020-04-02openpgp: Add limits to round_down and round_up.Nora Widdecke
2020-03-27openpgp: Implement fmt::Display for Timestamp, improve fmt::Debug.Justus Winter
2020-03-18openpgp: Add a conversion from Timestamp to Option<SystemTime>.Neal H. Walfield
2020-03-09Switch from failure to anyhow.Justus Winter
- Use the anyhow crate instead of failure to implement the dynamic side of our error handling. anyhow::Error derefs to dyn std::error::Error, allowing better interoperability with other stdlib-based error handling libraries. - Fixes #444.
2020-02-11openpgp: New function to normalize SystemTime.Justus Winter
2020-02-10openpgp: Add Timestamp::MAX.Neal H. Walfield
- Add a constant to represent the latest time representable by a `Timestamp`.
2020-02-09openpgp: Provide some convenient constants.Neal H. Walfield
2020-02-06openpgp: Fix name of setter.Justus Winter
2020-02-06openpgp: Rename methods 'set_policy' to 'with_policy'.Justus Winter
- Fixes #427.
2020-01-31openpgp: Add a policy object.Neal H. Walfield
- Change all functions that need to evaluate the validity of a signature (either directly or indirectly to take a policy object. - Use the policy object to allow the user to place additional constraints on a signature's validity. - This addresses the first half of #274 (it introduces the policy object, but does not yet implement any policy).
2020-01-20openpgp: Use the new framework for Cert::userid.Justus Winter
- Fixes #414.
2020-01-15openpgp: Add application example for Timestamp::round_down.Justus Winter
2020-01-15openpgp: Implement addition and subtraction of durations.Justus Winter
2020-01-08openpgp: Add convenience functions for masking timestamps.Justus Winter
- Timestamps can be used to identify people attending a common event, like a key signing party. By reducing the resolution of the time stamps, we can alleviate this problem. - Fixes #216.
2019-12-03openpgp: Add two new types, Timestamp and Duration.Justus Winter
- Timestamp and Duration represent dates and durations with the range and resolution that OpenPGP can represent. By using these types to store dates and durations, we enforce correct canonicalization.