Skip to content

Commit ed2852e

Browse files
committed
v0.3.42 release
1 parent 1067543 commit ed2852e

File tree

12 files changed

+54
-14
lines changed

12 files changed

+54
-14
lines changed

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,48 @@ The format is based on [Keep a Changelog]. This project adheres to [Semantic Ver
66

77
---
88

9+
## 0.3.42 [2025-08-31]
10+
11+
### Added
12+
13+
- `Time::duration_until`
14+
- `Time::duration_since`
15+
- `per_t` method for all types in `time::convert`. This is similar to the existing `per` method, but
16+
can return any of the primitive numeric types that can represent the result. This will cut down on
17+
`as` casts while ensuring correctness. Type inference isn't perfect, so you may need to provide a
18+
type annotation in some situations.
19+
- `impl PartialOrd for Month` and `impl Ord for Month`; this assumes the months are in the same year
20+
- `SystemTimeExt` trait, adding methods for checked arithmetic with `time::Duration` and obtaining
21+
the difference between two `SystemTime`s as a `time::Duration`
22+
- Permit using `UtcDateTime` with `rand` (this was inadvertently omitted previously)
23+
- `impl core::error::Error` for all error types (now available when the `std` feature is disabled)
24+
- MacOS can now obtain the local UTC offset in multi-threaded programs as the system APIs are
25+
thread-safe.
26+
- `#[track_caller]` has been added to all relevant methods.
27+
28+
### Changed
29+
30+
- The dependency on `itoa` has been removed, as the standard library now has similar functionality
31+
by default.
32+
- Formatting a component that involves a floating point number is now guaranteed to be
33+
deterministic, avoiding any subtle differences between platforms or compiler versions.
34+
35+
### Fixed
36+
37+
- Serializing timestamps with nanosecond precision _should_ always emit the correct value.
38+
Previously, it could be off by one nanosecond due to floating point imprecision.
39+
- A previously unknown bug in `OffsetDateTime::to_offset` and `UtcDateTime::to_offset` has been
40+
fixed. The bug could result in a value that was invalid. It was unlikely to ever occur in
41+
real-world code, as it involved passing a UTC offset that has never been used in any location.
42+
43+
### Miscellaneous
44+
45+
- The amount of code generated by macros has been massively reduced, on the order of 65-70% for
46+
typical use cases of `format_description!`.
47+
- Significant performance gains for comparisons of `Time`, `PrimitiveDateTime`, `UtcDateTime`, and
48+
`OffsetDateTime`. The first three have gains of approximately 85% (i.e. 6× faster).
49+
- Nearly all methods are `#[inline]`.
50+
951
## 0.3.41 [2025-03-23]
1052

1153
### Fixed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ members = ["time", "time-core", "time-macros"]
44
resolver = "2"
55

66
[workspace.dependencies]
7-
time-core = { path = "time-core", version = "=0.1.4" }
8-
time-macros = { path = "time-macros", version = "=0.2.22" }
7+
time-core = { path = "time-core", version = "=0.1.5" }
8+
time-macros = { path = "time-macros", version = "=0.2.23" }
99

1010
criterion = { version = "0.5.1", default-features = false }
1111
deranged = { version = "0.5.2", features = ["powerfmt"] }

time-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "time-core"
3-
version = "0.1.4"
3+
version = "0.1.5"
44
authors = ["Jacob Pratt <[email protected]>", "Time contributors"]
55
edition = "2021"
66
rust-version = "1.81.0"

time-core/src/convert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ macro_rules! impl_per {
7676

7777
#[doc = concat!("Obtain the number of times `", stringify!($t), "` can fit into `T`.")]
7878
#[doc = concat!("If `T` is smaller than `", stringify!($t), "`, the code will fail to")]
79-
/// compile. The return type is any primitive integer type that can represent the value.
79+
/// compile. The return type is any primitive numeric type that can represent the value.
8080
///
8181
/// Valid calls:
8282
///

time-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "time-macros"
3-
version = "0.2.22"
3+
version = "0.2.23"
44
authors = ["Jacob Pratt <[email protected]>", "Time contributors"]
55
edition = "2021"
66
rust-version = "1.81.0"

time/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "time"
3-
version = "0.3.41"
3+
version = "0.3.42"
44
authors = ["Jacob Pratt <[email protected]>", "Time contributors"]
55
edition = "2021"
66
rust-version = "1.81.0"

time/src/error/parse.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::error::{self, ParseFromDescription, TryFromParsed};
77

88
/// An error that occurred at some stage of parsing.
99
#[non_exhaustive]
10+
#[allow(variant_size_differences, reason = "only triggers on some platforms")]
1011
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1112
pub enum Parse {
1213
#[expect(missing_docs)]

time/src/error/try_from_parsed.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::error;
66

77
/// An error that occurred when converting a [`Parsed`](crate::parsing::Parsed) to another type.
88
#[non_exhaustive]
9+
#[allow(variant_size_differences, reason = "only triggers on some platforms")]
910
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1011
pub enum TryFromParsed {
1112
/// The [`Parsed`](crate::parsing::Parsed) did not include enough information to construct the

time/src/interop/js_sys_date_offsetdatetime.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use num_conv::prelude::*;
2-
31
use crate::convert::*;
42
use crate::OffsetDateTime;
53

0 commit comments

Comments
 (0)