commit_hash
stringlengths
40
40
author
stringlengths
1
57
date
timestamp[s]date
2010-07-26 04:45:09
2026-04-14 18:21:10
message
stringlengths
8
1.39M
diff
stringlengths
68
51.2k
files_changed
int64
1
136
insertions
int64
0
2.35k
deletions
int64
0
1.9k
26719d539f833d8d1b2be56d8e86e8f8ab3c7590
Andrew Gallant
2025-03-05T23:28:40
tz/posix: remove `Offset` on `DstInfo` This became superfluous with a prior refactor and can just be removed. Previously, we weren't filling in default values eagerly, so this was set to the default value when the DST offset was absent. But now we fill in the default values eagerly, so this just is not needed any more...
diff --git a/src/tz/posix.rs b/src/tz/posix.rs index 2b9dc98..b9c9be6 100644 --- a/src/tz/posix.rs +++ b/src/tz/posix.rs @@ -304,7 +304,7 @@ impl ReasonablePosixTimeZone { let dt = Offset::UTC.to_datetime(timestamp); self.dst_info_utc(dt.date().year_ranged()) .filter(|dst_info| dst_info.i...
1
19
24
b336d2ecc4edde29cbd03ba1f76b9a9797919666
Andrew Gallant
2025-03-05T23:28:19
bench: re-arrange and improve `tz` benchmarks This rounds out some of the different code paths on common `TimeZone` operations.
diff --git a/bench/Cargo.toml b/bench/Cargo.toml index 145a07b..6caa0c5 100644 --- a/bench/Cargo.toml +++ b/bench/Cargo.toml @@ -21,7 +21,7 @@ path = "src/bench.rs" [dependencies] criterion = { version = "0.5.1", default-features = false } -jiff = { path = ".." } +jiff = { path = "..", features = ["tzdb-bundle-alwa...
2
176
14
12ca7aaba77894e3fcdd96e97b61abc4b0266bb5
daalfox
2025-02-28T13:05:34
signed_duration: implement `Sum` Fixes #274, PR #282
diff --git a/src/signed_duration.rs b/src/signed_duration.rs index eb4c426..1273a73 100644 --- a/src/signed_duration.rs +++ b/src/signed_duration.rs @@ -2166,6 +2166,18 @@ impl core::ops::Mul<i32> for SignedDuration { } } +impl core::iter::Sum for SignedDuration { + fn sum<I: Iterator<Item = Self>>(iter: I) ...
1
36
0
c966d65a8abd3354ecc48ac815fae0bbd5aaa608
Andrew Gallant
2025-02-25T20:27:39
tests: add proc macro tests! Woohoo. We can finally use the proc macro. It was very satisfying seeing these tests run and pass on the first try. :-)
diff --git a/tests/lib.rs b/tests/lib.rs index 863845f..78ec5fd 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -1,4 +1,5 @@ // See: https://github.com/rust-lang/rust/pull/121364 #![allow(unknown_lints, ambiguous_negative_literals)] +mod procmacro; mod tc39_262; diff --git a/tests/procmacro/mod.rs b/tests/procmacr...
2
519
0
d12ab2cd6d1fdcec3c485d7023cf3535cbf2b993
Andrew Gallant
2025-02-24T21:11:18
jiff-cli: add `jiff-cli generate shared` command This is responsible for copying `jiff::shared` into the proc macro. We do some minor transformations, but otherwise the code remains the same.
diff --git a/crates/jiff-cli/cmd/generate/crc32.rs b/crates/jiff-cli/cmd/generate/crc32.rs index e914527..891f4d4 100644 --- a/crates/jiff-cli/cmd/generate/crc32.rs +++ b/crates/jiff-cli/cmd/generate/crc32.rs @@ -46,10 +46,11 @@ pub fn run(p: &mut Parser) -> anyhow::Result<()> { args::configure(p, USAGE, &mut [&mu...
6
225
1
c0be6c625cead998f551aac6cffa820455d81fe7
Andrew Gallant
2025-02-24T21:06:25
bench: fix benchmark name
diff --git a/bench/src/datetime.rs b/bench/src/datetime.rs index 6698974..c91aa5a 100644 --- a/bench/src/datetime.rs +++ b/bench/src/datetime.rs @@ -111,7 +111,7 @@ fn add_years_months_days(c: &mut Criterion) { /// This is useful when you have a known time zone already and want to get /// a specific instant for many ...
1
1
1
89f4946780ca7c5cab048a6c453f6ff3ac418c09
Andrew Gallant
2025-02-19T19:22:14
util: make more utility functions `const` I believe I'm going to need these in order to maintain some semblance of encapsulation and convert data handed to Jiff by the macro into the internal representations used by Jiff.
diff --git a/src/util/common.rs b/src/util/common.rs index c64ab61..60693c6 100644 --- a/src/util/common.rs +++ b/src/util/common.rs @@ -55,7 +55,7 @@ pub(crate) const fn days_in_month(year: i16, month: i8) -> i8 { /// Ref: https://github.com/cassioneri/eaf/blob/684d3cc32d14eee371d0abe4f683d6d6a49ed5c1/algorithms/neri...
1
11
11
e364c9f46c98fa0a772c9ff881282ff39bc12b12
Andrew Gallant
2025-02-19T03:53:11
civil: optimize Date addition with -1 or +1 days I originally didn't do this because it seemed kinda bush league, but this turns out to be a pretty common case via POSIX time zones. So let's just use `yesterday()` and `tomorrow()`, which will avoid a round-trip through Unix epoch days.
diff --git a/bench/src/date.rs b/bench/src/date.rs index 5cb5add..816ecb9 100644 --- a/bench/src/date.rs +++ b/bench/src/date.rs @@ -86,6 +86,13 @@ fn add_days(c: &mut Criterion) { 1070, civil::date(2026, 1, 17), ); + benchmark_with( + c, + "one", + civil::date(2023, 2, 12...
2
43
18
fd3eeecbf58a9507e3c3aa5f3246c83e4c2410dc
Andrew Gallant
2025-02-19T00:25:22
rangeint: add const constructor I believe this will be useful for shunting data between Jiff and proc macros.
diff --git a/src/util/rangeint.rs b/src/util/rangeint.rs index 406a114..e43a23d 100644 --- a/src/util/rangeint.rs +++ b/src/util/rangeint.rs @@ -138,6 +138,26 @@ macro_rules! define_ranged { } } + /// Like `new`, but monomorphic and works in a `const` context. + #[i...
1
20
0
1ef1715b355cb26feacb94c2cacc0a3966d583b5
Andrew Gallant
2025-02-18T22:28:31
util: make `ArrayStr::new` be `const` This is prep for experimenting with a proc macro to create a static `TimeZone`. We're going to need to expose a bunch of internal data types in order to permit a proc macro to create a `TimeZone`. I am very annoyed by this, but it's probably the least bad option. In theory, if Ru...
diff --git a/src/util/array_str.rs b/src/util/array_str.rs index fab7be6..8428ab1 100644 --- a/src/util/array_str.rs +++ b/src/util/array_str.rs @@ -28,22 +28,22 @@ impl<const N: usize> ArrayStr<N> { /// /// If the given string exceeds `N` bytes, then this returns /// `None`. - pub(crate) fn new(s: &s...
1
8
8
6f1e421c7d4ca2245275c46b6f4d41b7808d6e41
Andrew Gallant
2025-02-18T22:26:49
tests: sprinkle `cfg(not(miri))` in various spots This doesn't even make it possible to run `cargo miri test` for Jiff, but you can at least now do `cargo miri test tz`. I want this because I anticipate writing some tricky `unsafe` to do pointer tagging for `TimeZone`. The main problem with miri is unfortunately that...
diff --git a/src/civil/date.rs b/src/civil/date.rs index 7bac0e5..6dfc8de 100644 --- a/src/civil/date.rs +++ b/src/civil/date.rs @@ -3796,6 +3796,7 @@ mod tests { } #[test] + #[cfg(not(miri))] fn all_days_to_date_roundtrip() { for rd in -100_000..=100_000 { let rd = UnixEpochDa...
9
21
2
23ea9559b7dc8ca669fe249cb4120b665faf2b1b
Andrew Gallant
2025-02-18T02:53:05
error: make it possible to build an `Error` in a `const` context The resulting error is total shit, but at least one can be constructed. We could improve the messages to arbitrary strings using pointer tagging, but let's not get ahead of ourselves.
diff --git a/src/error.rs b/src/error.rs index 88e86ff..cac10ed 100644 --- a/src/error.rs +++ b/src/error.rs @@ -54,7 +54,7 @@ pub struct Error { /// This also makes clones cheap. And it also make the size of error equal /// to one word (although a `Box` would achieve that last goal). This is /// why we ...
1
50
15
475a2ce010d44f5b17268c6eb3b3d3a9ec69ee90
Andrew Gallant
2025-02-18T02:52:09
tz: tighten up `posix` module When I initially wrote the POSIX time zone parser, I had assumed that we would use both strict POSIX time zones and IANA v3+ POSIX time zones. But in practice, we just use the latter. So, let's bake that into the API and tighten things up a bit. We remove `IanaTz` and centralize everythi...
diff --git a/src/fmt/temporal/parser.rs b/src/fmt/temporal/parser.rs index f37c568..d0f33f5 100644 --- a/src/fmt/temporal/parser.rs +++ b/src/fmt/temporal/parser.rs @@ -530,9 +530,11 @@ impl DateTimeParser { } #[cfg(feature = "alloc")] { - match crate::tz::posix::IanaTz::parse_v3pl...
5
86
93
ffa9ab999fbd093e6da392a811624259b691f827
Andrew Gallant
2025-02-17T12:55:35
jiff-diesel-0.1.2
diff --git a/crates/jiff-diesel/Cargo.toml b/crates/jiff-diesel/Cargo.toml index 2634f05..75b3097 100644 --- a/crates/jiff-diesel/Cargo.toml +++ b/crates/jiff-diesel/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jiff-diesel" -version = "0.1.1" #:version +version = "0.1.2" #:version authors = ["Andrew Gallant <jamsl...
1
1
1
0054d73b741eaf5f60482e81286db0d8d6345212
Andrew Gallant
2025-02-17T12:54:36
jiff-diesel-0.1.1
diff --git a/crates/jiff-diesel/Cargo.toml b/crates/jiff-diesel/Cargo.toml index 79bd40e..2634f05 100644 --- a/crates/jiff-diesel/Cargo.toml +++ b/crates/jiff-diesel/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jiff-diesel" -version = "0.1.0" #:version +version = "0.1.1" #:version authors = ["Andrew Gallant <jamsl...
1
1
1
07e010b494372f6c3683e660a085d78e6d29e6cc
Andrew Gallant
2025-02-17T12:53:39
jiff-diesel: do some line wrapping Some of these lines were obscenely long. So wrap them. I'm not sure why rustfmt isn't doing this for me, but maybe the types are so long that it breaks rustfmt? Lol.
diff --git a/crates/jiff-diesel/src/nullable.rs b/crates/jiff-diesel/src/nullable.rs index 881ae5b..03a5c9a 100644 --- a/crates/jiff-diesel/src/nullable.rs +++ b/crates/jiff-diesel/src/nullable.rs @@ -15,9 +15,18 @@ use crate::ToDiesel; any(feature = "mysql", feature = "postgres", feature = "sqlite"), derive(...
2
24
6
1756ba03a47de6c98e8be9bb16cdfa2ef69ce59d
Gary Coady
2025-02-17T12:51:21
jiff-diesel: update tests to use Insertable and Selectable derivations This moves the majority of tests to use the `Insertable` and `Selectable` derivations from the query struct. This follows idiomatic Diesel usage, and also tests actual database round-tripping via database stores. The downside of this is that t...
diff --git a/examples/diesel-mysql/main.rs b/examples/diesel-mysql/main.rs index a4ff7dd..3a6534c 100644 --- a/examples/diesel-mysql/main.rs +++ b/examples/diesel-mysql/main.rs @@ -1,10 +1,32 @@ use diesel::{ - connection::Connection, mysql::MysqlConnection, query_dsl::RunQueryDsl, - sql_query, sql_types, Querya...
4
566
86
fd884445e1446826f7aface9ea4f49b2c6cced64
Josh Triplett
2025-02-14T19:58:34
doc: fix typo PR #264
diff --git a/src/timestamp.rs b/src/timestamp.rs index 7b601d1..cc3be4a 100644 --- a/src/timestamp.rs +++ b/src/timestamp.rs @@ -364,7 +364,7 @@ impl Timestamp { /// As a timestamp, it corresponds to `0` nanoseconds. /// /// A timestamp is positive if and only if it is greater than the Unix - /// epoc...
1
1
1
96ec82d6f0d97a03690a287806950b40449decc6
Gary Coady
2025-02-14T19:56:18
jiff-diesel: implement AsExpression for nullable wrappers PR #253
diff --git a/crates/jiff-diesel/src/nullable.rs b/crates/jiff-diesel/src/nullable.rs index c4ce2c9..881ae5b 100644 --- a/crates/jiff-diesel/src/nullable.rs +++ b/crates/jiff-diesel/src/nullable.rs @@ -11,6 +11,13 @@ use crate::ToDiesel; /// This can be used when deriving [`diesel::deserialize::Queryable`] /// or [`di...
1
88
23
e094b01adfc0faaeb78f2cf0b4888b028c686bee
Andrew Gallant
2025-02-11T02:39:16
crates: re-add jiff-{icu,sqlx,diesel} to workspace Now that `jiff 0.2` is published, I guess this should work now.
diff --git a/Cargo.toml b/Cargo.toml index a77ba34..352279a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,17 +31,14 @@ include = [ [workspace] members = [ "crates/jiff-cli", - # "crates/jiff-diesel", - # "crates/jiff-icu", - # "crates/jiff-sqlx", + "crates/jiff-diesel", + "crates/jiff-icu", + "crates/jiff-...
1
3
6
d0d1b2ec274ece09916acd985da60bf9a01be40e
Andrew Gallant
2025-02-11T02:30:53
crates: temporarily disconnect jiff-{icu,sqlx,diesel} from workspace ... I can't figure out how to publish `jiff 0.2` with these crates trying to select `jiff 0.2` from crates.io... which doesn't exist yet. WTF. I guess I'm probably holding Cargo workspaces wrong. ¯\_(ツ)_/¯
diff --git a/Cargo.toml b/Cargo.toml index 38720ec..201e948 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,14 +31,17 @@ include = [ [workspace] members = [ "crates/jiff-cli", - "crates/jiff-diesel", - "crates/jiff-icu", - "crates/jiff-sqlx", + # "crates/jiff-diesel", + # "crates/jiff-icu", + # "crates/jiff-...
4
15
12
c587fddbb72ed8bdc3c58ed859dbc2efe4799d79
Andrew Gallant
2025-02-11T02:11:50
fmt: add table of different formats supported by Jiff I think someone asked for this when `jiff 0.1` was released, and I thought it was a good idea then. But I hadn't gotten around to it. With the number of formats Jiff supports having expanded a bit since then, I think now is a good time to get this documented.
diff --git a/src/fmt/mod.rs b/src/fmt/mod.rs index 442ef60..fc7a7f4 100644 --- a/src/fmt/mod.rs +++ b/src/fmt/mod.rs @@ -5,6 +5,164 @@ Note that for most use cases, you should be using the corresponding [`Display`](std::fmt::Display) or [`FromStr`](std::str::FromStr) trait implementations for printing and parsing res...
2
195
14
8b61b3260227e5db0e0b9e08bb6741fa11eeca9f
Gary Coady
2025-02-10T22:00:00
jiff-diesel: add Nullable wrappers for Diesel types PR #248
diff --git a/crates/jiff-diesel/src/lib.rs b/crates/jiff-diesel/src/lib.rs index 2869955..822ed00 100644 --- a/crates/jiff-diesel/src/lib.rs +++ b/crates/jiff-diesel/src/lib.rs @@ -27,6 +27,11 @@ from the wrapper type to the corresponding Jiff type. * There are `From` trait implementations from the wrapper type to the...
3
410
0
65d48d1450d8c4c545a28cbb62323c65b134cb35
Gary Coady
2025-02-10T21:20:42
examples/diesel-*: update examples to use QueryableByName and sql_query PR #247
diff --git a/examples/diesel-mysql/main.rs b/examples/diesel-mysql/main.rs index d9d32f9..a4ff7dd 100644 --- a/examples/diesel-mysql/main.rs +++ b/examples/diesel-mysql/main.rs @@ -1,6 +1,6 @@ use diesel::{ - connection::Connection, dsl::sql, mysql::MysqlConnection, - query_dsl::RunQueryDsl, select, sql_types, E...
3
138
108
451d681511172a8f2761acf9f148a6bfa4c1098f
Gary Coady
2025-02-09T14:25:05
jiff-diesel: depend on Diesel's `postgres_backend` and `mysql_backend` features Diesel splits the mysql implementation between the `mysql_backend` feature which implements the types/traits/etc., and the `mysql` feature which also interfaces with the mysql client library. By depending on the backend feature, we can ...
diff --git a/crates/jiff-diesel/Cargo.toml b/crates/jiff-diesel/Cargo.toml index 7027415..4af22fd 100644 --- a/crates/jiff-diesel/Cargo.toml +++ b/crates/jiff-diesel/Cargo.toml @@ -21,8 +21,8 @@ path = "src/lib.rs" [features] default = [] -mysql = ["diesel/mysql"] -postgres = ["diesel/postgres"] +mysql = ["diesel/m...
1
2
2
a280ac6d46360d8af09da3c688f3bb6ec392a7a4
Gary Coady
2025-02-09T14:13:09
jiff-diesel: Diesel error needs to implement `std::error::Error` We fix this by making `jiff-diesel` always enable Jiff's `std` feature. PR #244
diff --git a/crates/jiff-diesel/Cargo.toml b/crates/jiff-diesel/Cargo.toml index 41eec6b..7027415 100644 --- a/crates/jiff-diesel/Cargo.toml +++ b/crates/jiff-diesel/Cargo.toml @@ -26,7 +26,7 @@ postgres = ["diesel/postgres"] sqlite = ["diesel/sqlite"] [dependencies] -jiff = { path = "../..", default-features = fal...
1
1
1
bc2b1a9eef296807484420b91ec26eaa56648b40
Gary Coady
2025-02-09T13:48:09
jiff-diesel: derive the `Queryable` trait for diesel wrapper types PR #243
diff --git a/crates/jiff-diesel/src/mysql.rs b/crates/jiff-diesel/src/mysql.rs index 401d911..c43cf46 100644 --- a/crates/jiff-diesel/src/mysql.rs +++ b/crates/jiff-diesel/src/mysql.rs @@ -1,5 +1,5 @@ use diesel::{ - deserialize::{self, FromSql, Queryable}, + deserialize::{self, FromSql}, mysql::{ ...
4
18
109
ef211be259a80375cd2737b48d999636e4d219ac
Andrew Gallant
2025-02-08T20:22:15
jiff-sqlx: fix link to examples
diff --git a/crates/jiff-sqlx/src/lib.rs b/crates/jiff-sqlx/src/lib.rs index 9145041..443202a 100644 --- a/crates/jiff-sqlx/src/lib.rs +++ b/crates/jiff-sqlx/src/lib.rs @@ -56,7 +56,7 @@ In the future, it may be prudent for this crate to be upstreamed into SQLx itself. [sqlx]: https://docs.rs/sqlx/0.8 -[examples]: ...
1
1
1
80255febda9ec0978d849350fecca67cfbda0318
Andrew Gallant
2025-02-02T19:32:04
crates: fixup homepage github URLs I forgot this in #236.
diff --git a/crates/jiff-cli/Cargo.toml b/crates/jiff-cli/Cargo.toml index 555b8f8..5d9d84a 100644 --- a/crates/jiff-cli/Cargo.toml +++ b/crates/jiff-cli/Cargo.toml @@ -8,7 +8,7 @@ A command line tool for supporting the development of the Jiff datetime library. Currently, this tool is not published and only used for d...
3
3
3
20e29e66c1e73170287465eb6265f4f6ddc5d950
Andrew Gallant
2025-01-30T12:31:08
tz/db/bundled: remove unused imports
diff --git a/src/tz/db/bundled/enabled.rs b/src/tz/db/bundled/enabled.rs index 163fcd1..06a7179 100644 --- a/src/tz/db/bundled/enabled.rs +++ b/src/tz/db/bundled/enabled.rs @@ -1,5 +1,3 @@ -use alloc::{string::String, vec::Vec}; - use crate::tz::{TimeZone, TimeZoneNameIter}; pub(crate) struct Database;
1
0
2
b0c3a38f919038d107ef3b207f587beb839c858e
Andrew Gallant
2025-02-01T18:25:47
tz: add one bug fix I meant to include this in #234, but it slipped my notice. Basically, if two offsets compare equal as-is, then it should always return true. Before this, if our parsed offset was `-00:44:30` and the time zone offset was `-00:44:30`, we were returning them as not equal because we skipped to roundin...
diff --git a/src/tz/offset.rs b/src/tz/offset.rs index cb0a34a..8aeaaaa 100644 --- a/src/tz/offset.rs +++ b/src/tz/offset.rs @@ -1836,7 +1836,7 @@ impl OffsetConflict { /// for the given datetime unambiguously has offset -00:44:30", /// ); /// let is_equal = |parsed: Offset, candidate: Offset| { - ...
1
1
1
94e8270bf06f0e760e80bcb19a6e3f41033e14a9
Andrew Gallant
2025-01-23T16:47:00
civil: to_date is deprecated, don't remove it yet! Oof.
diff --git a/src/civil/iso_week_date.rs b/src/civil/iso_week_date.rs index ff78036..d5dea30 100644 --- a/src/civil/iso_week_date.rs +++ b/src/civil/iso_week_date.rs @@ -312,7 +312,6 @@ impl ISOWeekDate { /// Deprecated APIs. impl ISOWeekDate { - /* /// A deprecated equivalent to [`ISOWeekDate::date`]. ...
1
0
2
a762e7164b13f3cf82a80187471fcf30da86e37d
Andrew Gallant
2025-01-23T16:46:10
civil: remove uses of deprecated ISOWeekDate::to_date I should get better at dog-fooding.
diff --git a/src/civil/date.rs b/src/civil/date.rs index a73e6f0..bc1a18a 100644 --- a/src/civil/date.rs +++ b/src/civil/date.rs @@ -3766,7 +3766,7 @@ mod tests { for day in 20..=days_in_month(year, month).get() { let date = date(year.get(), month.get(), day); ...
2
9
7
717b3f01ea6ab7bfaf24fc173101616d48e3674e
Andrew Gallant
2025-01-21T20:04:26
span: unexport unused crate-public API
diff --git a/src/span.rs b/src/span.rs index db6bc0e..981d05f 100644 --- a/src/span.rs +++ b/src/span.rs @@ -4331,7 +4331,7 @@ impl Unit { /// can vary in time depending on its reference point. A 'day' can as well, /// but we sorta special case 'day' to mean '24 hours' for cases where /// the user is dea...
1
1
1
9dd0b5ea3c64a9838f14e47ccdab908dcbc3ee90
Andrew Gallant
2025-01-16T18:34:37
lint: squash dead code warnings In most cases we just squash the warning instead of cfg'ing out the code. It is just super painful to correctly annotate everything piece of code otherwise.
diff --git a/src/lib.rs b/src/lib.rs index f4d73c2..4869581 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -669,7 +669,15 @@ For more, see the [`fmt::serde`] sub-module. (This requires enabling Jiff's deny(rustdoc::broken_intra_doc_links) )] // These are just too annoying to squash otherwise. -#![cfg_attr(not(featu...
2
10
2
684839fae407c94b5ef0d7150426b44126086a93
potatotech
2025-01-18T13:01:29
doc: suggest `intz` in `to_zoned` docs PR #207
diff --git a/src/civil/date.rs b/src/civil/date.rs index b810b30..116554a 100644 --- a/src/civil/date.rs +++ b/src/civil/date.rs @@ -1236,6 +1236,10 @@ impl Date { /// for more details. Note that ambiguous datetimes are handled in the same /// way as `DateTime::to_zoned`. /// + /// In the common case ...
3
9
1
6ca47d2afc34fa561c43603ad2bfeccf0534d30b
Andrew Gallant
2025-01-16T18:34:03
deps: bump jiff-tzdb-platform
diff --git a/Cargo.toml b/Cargo.toml index b10842e..01b8655 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -109,7 +109,7 @@ serde = { version = "1.0.203", optional = true, default-features = false } # is enabled by default, but that the `tzdb-bundle-platform` crate is only # actually used on platforms without a system t...
1
1
1
3867b6dd910d3641fc7ca7a4ef9b04017ed51771
Andrew Gallant
2025-01-16T18:33:46
jiff-tzdb-platform-0.1.2
diff --git a/jiff-tzdb-platform/Cargo.toml b/jiff-tzdb-platform/Cargo.toml index ea96054..ec2a2cb 100644 --- a/jiff-tzdb-platform/Cargo.toml +++ b/jiff-tzdb-platform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jiff-tzdb-platform" -version = "0.1.1" #:version +version = "0.1.2" #:version authors = ["Andrew Gallant...
1
1
1
d1364880d7488ebcb0d3c42e2a20e2aae025f6eb
Andrew Gallant
2025-01-16T18:33:36
deps: bump jiff-tzdb
diff --git a/Cargo.toml b/Cargo.toml index 3b7090a..b10842e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -100,7 +100,7 @@ tzdb-concatenated = ["std"] js = ["dep:wasm-bindgen", "dep:js-sys"] [dependencies] -jiff-tzdb = { version = "0.1.1", path = "jiff-tzdb", optional = true } +jiff-tzdb = { version = "0.1.2", path =...
2
2
2
837b438f83d0f559ea80d95f153347964efcb680
Andrew Gallant
2025-01-16T18:33:01
jiff-tzdb-0.1.2
diff --git a/jiff-tzdb/Cargo.toml b/jiff-tzdb/Cargo.toml index 34ba169..3468ea7 100644 --- a/jiff-tzdb/Cargo.toml +++ b/jiff-tzdb/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jiff-tzdb" -version = "0.1.1" #:version +version = "0.1.2" #:version authors = ["Andrew Gallant <jamslam@gmail.com>"] license = "Unlicense ...
1
1
1
c9c3ec5f2da5788174247466413240ab86e527ca
philomathic_life
2025-01-12T18:49:58
perf: allocate exact capacity for RFC 9110 strings PR #198
diff --git a/src/fmt/rfc2822.rs b/src/fmt/rfc2822.rs index 132a3c6..1da745a 100644 --- a/src/fmt/rfc2822.rs +++ b/src/fmt/rfc2822.rs @@ -1238,7 +1238,7 @@ impl DateTimePrinter { &self, timestamp: &Timestamp, ) -> Result<alloc::string::String, Error> { - let mut buf = alloc::string::String:...
1
1
1
2f57df3d31634c993269c589e6db721fd3ab3d73
Andrew Gallant
2025-01-01T17:38:32
span: remove commented out incorrect optimization I commented this out a while ago and meant to remove it since it turned out to be incorrect. Unfortunately, I don't quite remember the details of why it is wrong.
diff --git a/src/span.rs b/src/span.rs index cb96331..a901557 100644 --- a/src/span.rs +++ b/src/span.rs @@ -4986,14 +4986,6 @@ impl<'a> SpanRound<'a> { smallest = smallest.singular(), )); } - // Now that we've got our configuration, we can actually short circuit - /...
1
0
8
3b930e41b89844d6ea9a6cfe74b3c9ceba1d3364
Andrew Gallant
2024-12-31T19:09:04
util: centralize definition of time zone abbreviation I might want to use it in more places, so I think it makes sense to give a more utilitarian home.
diff --git a/src/fmt/strtime/mod.rs b/src/fmt/strtime/mod.rs index c56fbc9..f824fab 100644 --- a/src/fmt/strtime/mod.rs +++ b/src/fmt/strtime/mod.rs @@ -249,7 +249,9 @@ use crate::{ }, tz::{Offset, OffsetConflict, TimeZone, TimeZoneDatabase}, util::{ - self, escape, + self, + array_s...
3
64
60
7a41bf39facccfe5393edccb8359426122bf77a2
Andrew Gallant
2024-12-31T18:01:48
error: make Debug match Display I'm kind of annoyed that an `Error`'s `Debug` impl shows the full internal representation. In particular, this is something that *users* of Jiff will see due to `unwrap()` and the like. So it makes sense to tighten it up a bit. Jiff users don't need to care about the internal error kind...
diff --git a/src/error.rs b/src/error.rs index e8beb1e..8549d6e 100644 --- a/src/error.rs +++ b/src/error.rs @@ -43,7 +43,7 @@ pub(crate) use err; /// [about error types]. /// /// [about error types]: https://github.com/BurntSushi/jiff/issues/8 -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct Error { /// ...
1
23
1
1834cb510c4be27afde04152608ef3c158baadef
Andrew Gallant
2024-12-31T17:56:26
timestamp: improve docs surrounding arithmetic panics While this doesn't remove the arithmetic impls (I think that would be a bridge too far), we try to make the docs a little clearer and slightly improve the error message. The error message still doesn't say "why," but does hint at it a bit. Closes #145
diff --git a/src/span.rs b/src/span.rs index 9a00d04..cb96331 100644 --- a/src/span.rs +++ b/src/span.rs @@ -3047,7 +3047,9 @@ impl Span { let non_time_unit = self.largest_calendar_unit()?; Some(err!( "operation can only be performed with units of hours \ - or smaller, but fou...
2
26
15
396fdcfa61fb954e4c420645d0eb6777627cdd7f
Andrew Gallant
2024-12-28T21:21:42
tz: remove `Box<str>` for fixed time zone This removes yet another needless but harmless allocation in pursuit of progress on #168. In this case, returning a `&str` is part of the public API when a time zone is a fixed offset, so we do need to store the offset as a string somewhere. Thankfully, it's pretty small (sma...
diff --git a/src/tz/mod.rs b/src/tz/mod.rs index 55776a5..1931ef4 100644 --- a/src/tz/mod.rs +++ b/src/tz/mod.rs @@ -84,7 +84,6 @@ TO get the system's default time zone, use [`TimeZone::system`]. */ use alloc::{ - boxed::Box, string::{String, ToString}, sync::Arc, }; @@ -92,6 +91,7 @@ use alloc::{ us...
3
113
7
95dbd44a927c169e8409eb515d609773943cdcf7
Andrew Gallant
2024-12-28T19:29:49
fmt: rejigger some `alloc` imports I did this to get a sense for how much `jiff::fmt` depends on `alloc`. It actually looks pretty good. Most uses of `alloc` are just for convenience `String` APIs. The one hiccup is `strtime` where it uses `String` for IANA time zone names and time zone abbreviations. I think I can u...
diff --git a/src/fmt/mod.rs b/src/fmt/mod.rs index 86959f4..987f4a8 100644 --- a/src/fmt/mod.rs +++ b/src/fmt/mod.rs @@ -7,8 +7,6 @@ implementations for printing and parsing respectively. The APIs in this module provide more configurable support for printing and parsing. */ -use alloc::{string::String, vec::Vec}; -...
5
53
47
30dcb95447c21cdf95a969fb9a6da9a6a92d43cb
Andrew Gallant
2024-12-28T19:06:21
tz/posix: remove last bits of reliance on `alloc` We no longer keep around the "original" string we parsed for POSIX time zones. Instead, we implement `Display` for our POSIX TZ types, and that's how we'll show it in places that need it. This does mean that we show the parsed form instead of what the user actually pro...
diff --git a/src/tz/db/bundled/enabled.rs b/src/tz/db/bundled/enabled.rs index d0f393d..ff63c6a 100644 --- a/src/tz/db/bundled/enabled.rs +++ b/src/tz/db/bundled/enabled.rs @@ -33,7 +33,7 @@ impl BundledZoneInfo { } }; #[cfg(feature = "std")] - self::global::add(&tz); + self...
7
271
68
a8795c35e0a8dcc46527008f6a086c8cb7251f7d
Andrew Gallant
2024-12-28T03:51:01
cargo: fix feature config It turned out that our feature config testing was somewhat FUBAR. Namely, we were accidentally and unconditionally always enabling the `std` feature (among other default features) when running tests. This was a result of this *dev* dependency: jiff = { path = "./", features = ["serde"] } ...
diff --git a/Cargo.toml b/Cargo.toml index cfe9d70..285a6c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -108,7 +108,7 @@ icu = { version = "1.5.0", features = ["std"] } insta = "1.39.0" # We force `serde` to be enabled in dev mode so that the docs render and test # correctly. This is highly suspicious. -jiff = { pat...
13
96
89
4e82a43e23972b7753811a2a7cace07ef45dcb25
Andrew Gallant
2024-12-27T19:55:32
tz/posix: remove `Box<str>` used for POSIX time zone abbreviations As part of working toward #168, this commit puts POSIX time zone abbreviations inline instead of on the heap. We can generally rely on time zone abbreviations to be short, so this is "fine." This is obviously more annoying than just using `Box<str>`, ...
diff --git a/src/tz/posix.rs b/src/tz/posix.rs index 054afff..532ca7f 100644 --- a/src/tz/posix.rs +++ b/src/tz/posix.rs @@ -61,6 +61,7 @@ use crate::{ timestamp::Timestamp, tz::{AmbiguousOffset, Dst, Offset}, util::{ + array_str::ArrayStr, escape::{Byte, Bytes}, parse, ...
3
154
36
b8dad89b7dcd6b4e7605102a269880b4405dfb3c
Andrew Gallant
2024-12-27T18:37:49
lint: remove some `allow(..)` annotations This is mostly just removing some dead code, and in one case, finishing a refactoring to `SignedDuration` in `src/tz/posix.rs`.
diff --git a/src/span.rs b/src/span.rs index ebe96e5..15fa32f 100644 --- a/src/span.rs +++ b/src/span.rs @@ -2907,7 +2907,7 @@ impl Span { /// if this span has maximal values for all units, then rebalancing is /// not possible because the number of days after balancing would exceed /// the limit. - #[...
4
18
90
b482926123daf2a4d744a598c96f0d2ecafab4dd
Ben Beasley
2024-12-09T14:48:27
deps: update `chrono-tz` dev-dependency I confirmed that `cargo test --workspace` still passes. From the [release notes](https://github.com/chronotope/chrono-tz/releases/tag/v0.10.0): ``` ### Changes - Make `OffsetName::abbreviation` return an `Option`. This reflects that numeric values such as `+11` are n...
diff --git a/Cargo.toml b/Cargo.toml index 6ac317e..90c4b4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ wasm-bindgen = { version = "0.2.70", optional = true } [dev-dependencies] anyhow = "1.0.81" chrono = { version = "0.4.38", features = ["serde"] } -chrono-tz = "0.9.0" +chrono-tz = "0.10.0" # This a...
1
1
1
d538cd95aface3e93c9fcd116b48b47734a0339a
Min Kim
2024-10-17T21:16:23
doc: correct function reference in Timestamp The documentation for the deprecated `as_duration` function in `Timestamp` referenced a non-existent function `as_signed_duration`. It should point to `as_jiff_duration` instead. Closes #142
diff --git a/src/timestamp.rs b/src/timestamp.rs index 008be0c..79230b4 100644 --- a/src/timestamp.rs +++ b/src/timestamp.rs @@ -2132,7 +2132,7 @@ impl Timestamp { /// ``` #[deprecated( since = "0.1.5", - note = "use Timestamp::as_signed_duration instead" + note = "use Timestamp::as_jif...
1
1
1
74af3856f1b953f567f2a2e08b137fefeb04d52a
LeoniePhiline
2024-10-30T16:18:32
docs: fix a typo Closes #150
diff --git a/src/civil/date.rs b/src/civil/date.rs index 7585e1d..1b413fe 100644 --- a/src/civil/date.rs +++ b/src/civil/date.rs @@ -1236,7 +1236,7 @@ impl Date { /// /// # Example /// - /// This example shows how to created a zoned value with a fixed time zone + /// This example shows how to creat...
3
3
3
a937e453ae2b073cf3ec8502c054a2cf2a752475
LeoniePhiline
2024-10-31T15:54:42
test: verify serde YAML compatibility Deserializing `jiff` types from YAML is not currently possible. Neither `serde_yaml` nor its maintained fork `serde_yml` support deserializing from bytes. These tests serve in both - proving the current incompatibility - verifying the fix in the following commit, which migrat...
diff --git a/Cargo.toml b/Cargo.toml index d9fd996..44d2008 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -110,6 +110,7 @@ jiff = { path = "./", features = ["serde"] } quickcheck = { version = "1.0.3", default-features = false } serde = { version = "1.0.203", features = ["derive"] } serde_json = "1.0.117" +serde_yml =...
8
230
2
2f57962ad14a99cab2dbb66014b5b221727180f1
Andrew Gallant
2024-11-01T12:11:48
fmt/rfc2822: add routines explicitly for RFC 9110 It seems that RFC 9110 does not support offsets like `-0000` in the date format, and also requires that days be padded to two digits in all cases. This meant that Jiff's RFC 2822 output was, strictly speaking, incompatible with a strict implementation of RFC 9110. For ...
diff --git a/src/fmt/rfc2822.rs b/src/fmt/rfc2822.rs index 1fc9de9..1851705 100644 --- a/src/fmt/rfc2822.rs +++ b/src/fmt/rfc2822.rs @@ -579,7 +579,7 @@ impl DateTimeParser { } let (day, input) = input.split_at(digits); let day = parse::i64(day).with_context(|| { - err!("failed to ...
1
174
1
d3e0a16495df21ba86b908f6152932178753e5f0
Plecra
2024-09-22T13:02:20
doc: tweak definition of Timestamp The previous definition was slightly incorrect, or at best, imprecise. It is actually pretty important to mention that `Timestamp` is in the Unix time scale (the same as the POSIX time scale), as this clarifies that it behaves as if leap seconds don't exist. PR #134
diff --git a/src/timestamp.rs b/src/timestamp.rs index 5df3d15..5510114 100644 --- a/src/timestamp.rs +++ b/src/timestamp.rs @@ -23,7 +23,7 @@ use crate::{ /// An instant in time represented as the number of nanoseconds since the Unix /// epoch. /// -/// A timestamp is always in UTC. +/// A timestamp is always in th...
1
1
1
9d2b8a6963a975cf7ab2f95a310fde82ad833b7f
Andrew Gallant
2024-09-08T17:41:41
fmt: rejigger internal precision setting Previously, we accepted `precision: u8` and inferred "not set" as "automatic precision." But this actually ends up making some call sites more complicated than they need to be. It's better to just require an `Option<u8>` since that tends to be what callers have.
diff --git a/src/fmt/strtime/format.rs b/src/fmt/strtime/format.rs index 45bb4f9..c185139 100644 --- a/src/fmt/strtime/format.rs +++ b/src/fmt/strtime/format.rs @@ -569,10 +569,7 @@ impl Extension { ) -> Result<(), Error> { let number = number.into(); - let mut formatter = FractionalFormatter::ne...
3
14
20
b32942779875d8c13b111d88567771592b954245
Andrew Gallant
2024-09-08T17:12:48
util: move UTF-8 decoding to its own module This moves UTF-8 decoding from an internal helper in `jiff::util::escape` to a crate-wide helper in `jiff::util::utf8`. This makes it easier for other code to use this. I may end up using it for #111, for example.
diff --git a/src/util/escape.rs b/src/util/escape.rs index a2ebf94..4528f4b 100644 --- a/src/util/escape.rs +++ b/src/util/escape.rs @@ -4,6 +4,8 @@ Provides convenience routines for escaping raw bytes. This was copied from `regex-automata` with a few light edits. */ +use crate::util::utf8; + /// Provides a conven...
3
52
50
60aef20dc262745bbbed164d67bdff18ddef71ce
Andrew Gallant
2024-09-07T14:12:34
fmt: simplify integer formatting slightly It turns out that "no padding set" and "padding is zero" result in the same behavior. I think this might have been different back when I was (ab)using the integer formatting to also do fractional formatting. But either way, eliminating a redundant internal state is a win. I d...
diff --git a/src/fmt/util.rs b/src/fmt/util.rs index 568abf3..97c5d0e 100644 --- a/src/fmt/util.rs +++ b/src/fmt/util.rs @@ -18,7 +18,7 @@ use crate::{ #[derive(Clone, Copy, Debug)] pub(crate) struct DecimalFormatter { force_sign: Option<bool>, - minimum_digits: Option<u8>, + minimum_digits: u8, paddi...
1
6
8
87054e807d2e2e88a3ba5969c8e1f4a40355b21c
Andrew Gallant
2024-09-07T13:57:05
cargo: bump jiff-tzdb and jiff-tzdb-platform to 0.1.1
diff --git a/Cargo.toml b/Cargo.toml index 303a1c3..5d673bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,7 +75,7 @@ tzdb-zoneinfo = ["std"] js = ["dep:wasm-bindgen", "dep:js-sys"] [dependencies] -jiff-tzdb = { version = "0.1.0", path = "jiff-tzdb", optional = true } +jiff-tzdb = { version = "0.1.1", path = "jiff...
1
2
2
d6dc8841a405c1d6fbb670a8f028f0cbb901fcf7
Andrew Gallant
2024-09-07T13:56:10
jiff-tzdb-platform-0.1.1
diff --git a/jiff-tzdb-platform/Cargo.toml b/jiff-tzdb-platform/Cargo.toml index 38d145c..bc0bbb3 100644 --- a/jiff-tzdb-platform/Cargo.toml +++ b/jiff-tzdb-platform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jiff-tzdb-platform" -version = "0.1.0" #:version +version = "0.1.1" #:version authors = ["Andrew Gallant...
1
1
1
7d866259a2e02dc117adedde17e9d1d896d21544
Andrew Gallant
2024-09-07T13:55:55
tzdb-platform: bump jiff-tzdb to 0.1.1
diff --git a/jiff-tzdb-platform/Cargo.toml b/jiff-tzdb-platform/Cargo.toml index 99073eb..38d145c 100644 --- a/jiff-tzdb-platform/Cargo.toml +++ b/jiff-tzdb-platform/Cargo.toml @@ -21,4 +21,4 @@ bench = false path = "lib.rs" [dependencies] -jiff-tzdb = { version = "0.1.0", path = "../jiff-tzdb" } +jiff-tzdb = { ver...
1
1
1
2d05b8d0a56e51b41267f512048ec60f9e17ba9a
Andrew Gallant
2024-09-07T13:55:20
jiff-tzdb-0.1.1
diff --git a/jiff-tzdb/Cargo.toml b/jiff-tzdb/Cargo.toml index c962c6e..ee2fa0b 100644 --- a/jiff-tzdb/Cargo.toml +++ b/jiff-tzdb/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jiff-tzdb" -version = "0.1.0" #:version +version = "0.1.1" #:version authors = ["Andrew Gallant <jamslam@gmail.com>"] license = "Unlicense ...
1
1
1
74c47270fb39ea614b37cad43324dde96924df29
Andrew Gallant
2024-08-31T18:08:09
timestamp: add Timestamp::display_with_offset This provides a more convenient and more easily discoverable interface to `jiff::fmt::temporal::DateTimePrinter::print_timestamp_with_offset`.
diff --git a/src/lib.rs b/src/lib.rs index a1d19b0..6493a4f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -688,8 +688,8 @@ pub use crate::{ SpanTotal, ToSpan, Unit, }, timestamp::{ - Timestamp, TimestampArithmetic, TimestampDifference, TimestampRound, - TimestampSeries, + Timestamp...
2
109
5
aa0ca78bbd3741b96bc6ca9a17e962e979b7c2e4
Andrew Gallant
2024-08-31T17:31:47
fmt/rfc2822: add 'to_string' convenience routines This mimics the previous commit, but for the RFC 2822 datetime printer.
diff --git a/src/fmt/rfc2822.rs b/src/fmt/rfc2822.rs index b38535d..1fc9de9 100644 --- a/src/fmt/rfc2822.rs +++ b/src/fmt/rfc2822.rs @@ -1099,6 +1099,101 @@ impl DateTimePrinter { DateTimePrinter { _private: () } } + /// Format a `Zoned` datetime into a string. + /// + /// This never emits `-00...
1
95
0
13cc178cb5b85c56a991f64cfd9c04582a75930e
Andrew Gallant
2024-08-31T14:38:37
fmt/temporal: add 'to_string' convenience routines to Temporal printers I think this is a big ergonomic win for a very common case. It makes using the datetime and span printers much nicer, and they are necessary to use in some cases when the output format needs more configuration.
diff --git a/src/fmt/temporal/mod.rs b/src/fmt/temporal/mod.rs index aca4c1d..c50a428 100644 --- a/src/fmt/temporal/mod.rs +++ b/src/fmt/temporal/mod.rs @@ -163,6 +163,8 @@ There is some more [background on Temporal's format] available. [background on Temporal's format]: https://github.com/tc39/proposal-temporal/issue...
1
252
6
b174e257217cee47086278cffe1e88f328b0d6fd
Andrew Gallant
2024-08-31T14:25:14
fmt: add some #[inline] annotations These are just on the config settings. In newer versions of Rust, I'd expect these to get cross-crate inlined since they are trivial. And of course, when used in a const context, it doesn't matter if they get inlined. But these really should always be inlined, so add the annotation ...
diff --git a/src/fmt/rfc2822.rs b/src/fmt/rfc2822.rs index 43402d8..b38535d 100644 --- a/src/fmt/rfc2822.rs +++ b/src/fmt/rfc2822.rs @@ -105,6 +105,7 @@ pub(crate) static DEFAULT_DATETIME_PRINTER: DateTimePrinter = /// /// # Ok::<(), Box<dyn std::error::Error>>(()) /// ``` +#[inline] pub fn to_string(zdt: &Zoned) -...
2
13
0
8173cdbccdb48b7dc3711b9163dfd594c66e51ab
Andrew Gallant
2024-08-31T14:16:23
fmt/temporal: add DateTimePrinter::print_timestamp_with_offset This makes it possible to format a `Timestamp` with a specific offset. This was already technically possible with the `strftime` API, but adding explicit support for it to the `jiff::fmt::temporal` module seems like good sense. Note that no dedicated pars...
diff --git a/src/fmt/temporal/mod.rs b/src/fmt/temporal/mod.rs index 59552dd..3877eb5 100644 --- a/src/fmt/temporal/mod.rs +++ b/src/fmt/temporal/mod.rs @@ -168,7 +168,7 @@ use crate::{ error::Error, fmt::Write, span::Span, - tz::{Disambiguation, OffsetConflict, TimeZoneDatabase}, + tz::{Disambigua...
2
100
6
3b4bd069d6d011bc927fccfd3d1de421c993bf37
Andrew Gallant
2024-08-29T15:57:01
cargo: update keywords and categories Jiff is no-std. I think the `temporal` and `iana` keywords probably don't carry their weight. So replace the with hopefully better keywords, `calendar` and `duration`. We keep `zone` to hit "time zone" queries.
diff --git a/Cargo.toml b/Cargo.toml index ad22303..ffb2094 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,8 @@ A date-time library that encourages you to jump into the pit of success. This library is heavily inspired by the Temporal project. ''' -categories = ["date-and-time"] -keywords = ["date", "time", "...
1
2
2
b63d9e6eeedd1f80e93210bd9a108282f011e56c
Martin von Zweigbergk
2024-08-28T16:07:12
util/libm: replace `force_eval!` by `core::hint::black_box` During an internal review of unsafe code at work, @cramertj noticed that the the `force_eval!` can be replaced by `core::hint::black_box`, removing the need for unsafe Rust. It's not totally clear that this is fully correct for x86 (note: not x86-64) si...
diff --git a/src/util/libm.rs b/src/util/libm.rs index 75d3772..abb5fe4 100644 --- a/src/util/libm.rs +++ b/src/util/libm.rs @@ -24,12 +24,6 @@ pub(crate) trait Float { fn fract(self) -> Self; } -macro_rules! force_eval { - ($e:expr) => { - core::ptr::read_volatile(&$e) - }; -} - const TOINT64: f6...
1
8
30
9c757139a74849b612e3ef4949f43e6cf7eed739
Andrew Gallant
2024-08-24T13:15:03
zoned: add note about Timestamp::now().to_zoned() This PR adds a note to the `Zoned::now()` documentation describing the best way to create a `Zoned` for the current time in a time zone that isn't the system time zone. Unfortunately, one intuitive route is `Zoned::now().with_time_zone()`, but this 1) fetches the syste...
diff --git a/src/zoned.rs b/src/zoned.rs index c907a12..5481fb0 100644 --- a/src/zoned.rs +++ b/src/zoned.rs @@ -384,6 +384,12 @@ impl Zoned { /// compatible with the `log` crate and enable Jiff's `logging` Cargo /// feature.) /// + /// To create a `Zoned` value for the current time in a particular + ...
1
6
0
0e569cba9884a4d1093410c81324991cb3ce0984
Rui Fan
2024-08-18T08:24:32
bench: add zoned benchmark for Asia/Shanghai This is useful because Asia/Shanghai doesn't have DST, so this helps measure the flow through the code when DST doesn't need to be handled. That is, there are some shortcuts we can take. Closes #103
diff --git a/bench/src/bench.rs b/bench/src/bench.rs index 427e40f..4de8fa6 100644 --- a/bench/src/bench.rs +++ b/bench/src/bench.rs @@ -116,56 +116,66 @@ fn civil_datetime_to_instant_static(c: &mut Criterion) { /// specific time zone. fn instant_to_civil_datetime_static(c: &mut Criterion) { const NAME: &str = "...
1
43
33
8839f9c1c7054191f5ea42298a1e6823c7d765c7
Andrew Gallant
2024-08-22T21:53:08
doc: small fixes
diff --git a/src/fmt/temporal/parser.rs b/src/fmt/temporal/parser.rs index 6120ff6..c03b552 100644 --- a/src/fmt/temporal/parser.rs +++ b/src/fmt/temporal/parser.rs @@ -18,7 +18,7 @@ use crate::{ pub(super) struct ParsedDateTime<'i> { /// The original input that the datetime was parsed from. input: escape::B...
2
3
3
ae6000b1f457fbf1c650ef61c4677e033f1e83dc
Andrew Gallant
2024-08-18T21:41:24
cargo: permit windows-sys >=0.52.0 and <=0.59.* This matches a similar change made by @ChrisDenton for winapi-util in: https://github.com/BurntSushi/winapi-util/pull/19 The benefit is that this should hopefully put less constraints on the ecosystem and to enable fewer copies of windows-sys to appear in dependency tre...
diff --git a/Cargo.toml b/Cargo.toml index 0d9a130..ffcacae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,7 +87,7 @@ serde = { version = "1.0.203", optional = true } jiff-tzdb-platform = { version = "0.1.0", path = "jiff-tzdb-platform", optional = true } [target.'cfg(windows)'.dependencies.windows-sys] -version =...
1
1
1
ee53cd9f45ae9c85f34cb4553dd5d61c7ced8776
Andrew Gallant
2024-08-18T21:28:35
tz: use SignedDuration for POSIX offset arithmetic Since this operates on a civil::DateTime, I don't think there's much benefit, although there is a slight improvement in some benchmarks (~3%). I suspect the civil::DateTime arithmetic (particularly civil::Time) could probably be improved.
diff --git a/src/tz/offset.rs b/src/tz/offset.rs index cc401de..449065b 100644 --- a/src/tz/offset.rs +++ b/src/tz/offset.rs @@ -834,19 +834,11 @@ impl Offset { SignedDuration::offset_until(other, self) } - /// Returns this offset as a [`Span`]. - #[inline] - pub(crate) fn to_span(self) -> Span...
2
26
32
b06cd131920273856609b2f8ae1cb6b54461b027
Andrew Gallant
2024-08-18T19:10:31
bench: tweak benchmarks and optimize some cases This makes some cases of adding durations to Timestamp/Zoned faster. It does seem like there is some room left here to improved. But making Zoned truly faster is difficult because of its higher level abstraction facilities.
diff --git a/bench/Cargo.toml b/bench/Cargo.toml index 50b3e05..f991be3 100644 --- a/bench/Cargo.toml +++ b/bench/Cargo.toml @@ -31,3 +31,6 @@ time = { version = "0.3.36", features = ["macros", "parsing"] } [profile.release] debug = true + +[profile.bench] +debug = true diff --git a/bench/src/bench.rs b/bench/src/b...
6
161
24
0904055a11e95b83c0296d1b4f9d5f7e90f29e8e
Andrew Gallant
2024-08-18T16:40:01
signed_duration: add some clarifying examples
diff --git a/src/signed_duration.rs b/src/signed_duration.rs index b19428d..2b5f157 100644 --- a/src/signed_duration.rs +++ b/src/signed_duration.rs @@ -170,6 +170,113 @@ use crate::util::libm::Float; /// (as long as they're within Jiff's limits), including durations with units /// of years, months, weeks and days. A...
1
107
0
6de09490f92319a2947a206fd76b39baeb49dc8e
Andrew Gallant
2024-08-18T15:56:23
api: remove 'impl Into' from parameter types I think this was an oversight. I generally don't like using 'impl Trait' in public APIs unless there is no avoiding it. In particular, when using 'impl Trait', it inhibits the use of turbofish, which can sometimes be useful.
diff --git a/src/civil/datetime.rs b/src/civil/datetime.rs index b5da48c..07931f1 100644 --- a/src/civil/datetime.rs +++ b/src/civil/datetime.rs @@ -2140,9 +2140,9 @@ impl DateTime { /// # Ok::<(), Box<dyn std::error::Error>>(()) /// ``` #[inline] - pub fn round( + pub fn round<R: Into<DateTimeRoun...
6
23
23
981d5eea004279cfafcbf5dbd135c0f1c7c0f395
Andrew Gallant
2024-08-18T15:49:48
span: add support for absolute durations This makes it possible to use `Span::checked_add` with `SignedDuration` and `std::time::Duration`. We don't need to add any new "target" types because we already had a `SpanArithmetic`. So mostly this was just about adding new trait impls and support for adding an absolute dura...
diff --git a/src/span.rs b/src/span.rs index 66fd0ce..5c02f32 100644 --- a/src/span.rs +++ b/src/span.rs @@ -1,9 +1,10 @@ -use core::{cmp::Ordering, time::Duration}; +use core::{cmp::Ordering, time::Duration as UnsignedDuration}; use alloc::borrow::Cow; use crate::{ civil::{Date, DateTime, Time}, + durati...
1
297
126
f791a12beb4a4cc621f2131e083c667a25544c0c
Andrew Gallant
2024-08-14T01:46:09
tz: re-arrange relative ordering of methods on Offset This makes it match how 'add' and 'until' methods are ordered on the datetime types.
diff --git a/src/tz/offset.rs b/src/tz/offset.rs index d29f1b5..b6c1f24 100644 --- a/src/tz/offset.rs +++ b/src/tz/offset.rs @@ -453,67 +453,6 @@ impl Offset { .checked_sub_seconds(i64::from(self.seconds())) } - /// Returns the span of time from this offset until the other given. - /// - //...
1
61
61
c395ac05f3e64471f7122610e6d652bd30781cbf
Andrew Gallant
2024-08-11T13:34:02
signed_duration: add methods for computing durations between datetimes These methods permit completely circumventing the `Span` type. They aren't exported yet. We'll do that by adding new methods on the various datetime types in a subsequent commit.
diff --git a/src/signed_duration.rs b/src/signed_duration.rs index 531a32b..01b6957 100644 --- a/src/signed_duration.rs +++ b/src/signed_duration.rs @@ -1,8 +1,10 @@ use core::time::Duration; use crate::{ + civil::{Date, DateTime, Time}, error::{err, ErrorContext}, - Error, + tz::Offset, + Error, T...
2
135
59
0d1f95a99e75f90723b50439e4c6d47c836b4dcd
Andrew Gallant
2024-08-07T14:01:53
util/libm: add f32 libm support This is basically just vendoring the 'f' variants (e.g., 'truncf') from the `libm` crate.
diff --git a/src/util/libm.rs b/src/util/libm.rs index bb2b865..75d3772 100644 --- a/src/util/libm.rs +++ b/src/util/libm.rs @@ -140,6 +140,123 @@ impl Float for f64 { } } +impl Float for f32 { + fn abs(self) -> f32 { + if self.is_sign_negative() { + -self + } else { + sel...
1
125
0
f77220c8289f4e794911585971aaa6a1e39c5b1d
Andrew Gallant
2024-08-07T13:47:31
util/libm: prepare for f32 support Previously we framed our tiny little libm port as specific to f64. But in order to support SignedDuration::try_from_secs_f32, I think we'll want f32 libm routines too. So rename and tweak the trait to be less specific to f64.
diff --git a/src/now.rs b/src/now.rs index 68eb21c..d059dd7 100644 --- a/src/now.rs +++ b/src/now.rs @@ -44,7 +44,7 @@ mod sys { use std::time::Duration; #[cfg(not(feature = "std"))] - use crate::util::libm::F64; + use crate::util::libm::Float; let millis = js_sys::Date::new...
4
20
20
318c68d9b2df13d5f3100915cbde58065c0e7bf8
Andrew Gallant
2024-08-07T13:43:36
util/libm: add 'fract' method
diff --git a/src/util/libm.rs b/src/util/libm.rs index 9e0f9de..d5982d2 100644 --- a/src/util/libm.rs +++ b/src/util/libm.rs @@ -6,10 +6,10 @@ wouldn't necessarily mind depending on `libm`, but I don't think there's a way to express "only depend on a crate if some on-by-default feature is not enabled." -We also ver...
1
9
4
529105edceebd867123244a3f9b68c96088e1537
Rui Fan
2024-08-18T15:36:09
perf: avoid binary search in to_offset in some cases Specifically, when one knows that the timestamp is bigger than the biggest transition, we can skip the binary search and just jump directly to using the POSIX TZ rule.
diff --git a/src/tz/tzif.rs b/src/tz/tzif.rs index 8990e72..a21b9fe 100644 --- a/src/tz/tzif.rs +++ b/src/tz/tzif.rs @@ -117,17 +117,24 @@ impl Tzif { // The result of the dummy transition is that the code below is simpler // with fewer special cases. assert!(!self.transitions.is_empty(), "tr...
1
18
11
76c103e50288ee326a9d58e9fff2b1af64ef9596
Rui Fan
2024-08-18T11:54:56
perf: short circuit in POSIX tz when there is no DST Ref #103 PR #104
diff --git a/src/tz/posix.rs b/src/tz/posix.rs index 63f7ebf..02ee604 100644 --- a/src/tz/posix.rs +++ b/src/tz/posix.rs @@ -286,6 +286,10 @@ impl ReasonablePosixTimeZone { &self, timestamp: Timestamp, ) -> (Offset, Dst, &str) { + if self.dst.is_none() { + return (self.std_offse...
1
4
0
5b110898ec6572b04d08949ed05ea466c8ae86ff
Andrew Gallant
2024-08-15T14:42:35
lint: remove ambiguous_negative_literal allow's in doc tests In favor of a global one. But also, while these aren't technically needed any more[1,2], we leave them be for now while things settle. [1]: https://github.com/rust-lang/rust/pull/128449 [2]: https://github.com/rust-lang/rust/issues/128287
diff --git a/src/civil/date.rs b/src/civil/date.rs index 79d84fc..ee56cbe 100644 --- a/src/civil/date.rs +++ b/src/civil/date.rs @@ -1367,8 +1367,6 @@ impl Date { /// # Example: negative spans are supported /// /// ``` - /// # // See: https://github.com/rust-lang/rust/pull/121364 - /// # #![allow(u...
8
2
120
abae98ea88c8d699ef466a49d0318856bc2c25f1
Andrew Gallant
2024-08-14T23:48:08
cargo: use 'dep' for optional dependencies This was an oversight. The 'js-sys' and 'wasm-bindgen' dependencies only be referenced as dependencies. They aren't features themselves. (And they were never documented as such, so this change is justifiable in a semver compatible release.)
diff --git a/Cargo.toml b/Cargo.toml index 026f0ba..5c419d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,7 +72,7 @@ tzdb-zoneinfo = ["std"] # on Jiff directly and enable the `js` feature themselves. # # (This is the same dependency setup that the `getrandom` crate uses.) -js = ["wasm-bindgen", "js-sys"] +js = ["d...
1
1
1
7da2731211b3f51b9f9c251f8d9a91d58321ec6c
Andrew Gallant
2024-08-14T23:47:55
util/rangeint: squash new warnings on nightly
diff --git a/src/util/rangeint.rs b/src/util/rangeint.rs index 39c6492..47ae0a0 100644 --- a/src/util/rangeint.rs +++ b/src/util/rangeint.rs @@ -113,6 +113,7 @@ macro_rules! define_ranged { val: impl Into<i64>, ) -> Result<Self, Error> { let val = val.into(); + ...
1
3
0
c659069a2765a5e28ba503ea37e8a2eee4b10a92
Andrew Gallant
2024-08-11T12:24:40
span: improve invalid units error message Previously, we would report a range error when trying to use units of days or greater in a span when adding to a `Timestamp`. But this error doesn't really do a good job of explaining anything. It was a hold-over from the days where I was using many different error types and i...
diff --git a/src/span.rs b/src/span.rs index 62aba66..52d1ce9 100644 --- a/src/span.rs +++ b/src/span.rs @@ -2722,17 +2722,22 @@ impl Span { pub(crate) fn smallest_non_time_non_zero_unit_error( &self, ) -> Option<Error> { - if self.days != 0 { - Some(t::SpanDays::error("days", self....
1
12
7
224eee99a04ddaec2b6da98acdaa35733c51701e
Nuutti Kotivuori
2024-08-08T13:42:59
util: days in month rangeint should always have range 28-31 PR #85
diff --git a/src/util/common.rs b/src/util/common.rs index 55fb207..e6ef64c 100644 --- a/src/util/common.rs +++ b/src/util/common.rs @@ -62,7 +62,7 @@ pub(crate) fn saturate_day_in_month( /// February. pub(crate) fn days_in_month(year: Year, month: Month) -> Day { if month == 2 && is_leap_year(year) { - D...
1
14
14
60ba273fa1232ef859d253ab3b284ca6a0ddb50f
Andrew Gallant
2024-08-03T20:27:27
fmt/strtime: remove note that IANA time zone identifiers aren't supported Because they are supported now, as of #75.
diff --git a/src/fmt/strtime/mod.rs b/src/fmt/strtime/mod.rs index a29399f..3bee55f 100644 --- a/src/fmt/strtime/mod.rs +++ b/src/fmt/strtime/mod.rs @@ -132,11 +132,6 @@ assert_eq!(date.strftime("%Y%m%d").to_string(), "09990715"); # Ok::<(), Box<dyn std::error::Error>>(()) ``` -Additionally, the parsing and formatt...
1
0
5
38bc73ad476e974de2563b0d898a32ccaf220b30
Andrew Gallant
2024-08-03T14:05:01
fmt: migrate other fractional printing to FractionalFormatter This migrates everything else over. This also explains why we were able to previously get away with hacking the DecimalFormatter to emit fractions: every other use of FractionalFormatter doesn't care about setting a fixed precision. Although we may want to ...
diff --git a/src/fmt/offset.rs b/src/fmt/offset.rs index 3b15b76..96da13b 100644 --- a/src/fmt/offset.rs +++ b/src/fmt/offset.rs @@ -106,7 +106,7 @@ from [Temporal's hybrid grammar]. use crate::{ error::{err, Error, ErrorContext}, fmt::{ - util::{parse_temporal_fraction, DecimalFormatter}, + ut...
3
11
60
a23300af39890340f26128acde6473f783793948
Andrew Gallant
2024-08-03T13:45:25
fmt: add FractionalFormatter Previously, we were formatting fractional components of numbers by kinda abusing the DecimalFormatter. But in order to fix #73, I found it simpler to split the fractional case out of the "normal" number formatting. This commit just adds the fractional formatter. Subsequent commits will mi...
diff --git a/src/fmt/mod.rs b/src/fmt/mod.rs index c0d610d..a0a185a 100644 --- a/src/fmt/mod.rs +++ b/src/fmt/mod.rs @@ -14,7 +14,7 @@ use crate::{ util::escape, }; -use self::util::{Decimal, DecimalFormatter}; +use self::util::{Decimal, DecimalFormatter, Fractional, FractionalFormatter}; mod offset; pub mo...
2
177
1
c1b1ca433ac604883a88f7077dff860ae1094c3e
David Peter
2024-08-02T20:52:16
doc: minor correction: "printf"-style API PR #71
diff --git a/src/civil/date.rs b/src/civil/date.rs index ed63536..f1b8590 100644 --- a/src/civil/date.rs +++ b/src/civil/date.rs @@ -2075,11 +2075,11 @@ impl Date { } } -/// Parsing and formatting using a "printf" style of API. +/// Parsing and formatting using a "printf"-style API. impl Date { /// Parses...
6
16
16
019696cf61c608a783838400732a947778eecb8e
Andrew Gallant
2024-08-02T00:15:11
fmt/strtime: make parsing aware of padding settings In order to make #62 work, we need some way of "limiting" the parsing of numbers. So for example, when parsing a year, we shouldn't try to parse more than 4 digits. And when parsing a month, we shouldn't try to parse more than 2 digits. This isn't a big deal, except...
diff --git a/src/fmt/strtime/mod.rs b/src/fmt/strtime/mod.rs index ba44572..257566b 100644 --- a/src/fmt/strtime/mod.rs +++ b/src/fmt/strtime/mod.rs @@ -75,42 +75,50 @@ assert_eq!( # Advice The formatting machinery supported by this module is not especially expressive. -The pattern language is a simple sequence of ...
2
243
110
5020f75ff8f1176238d2b1d7d00a631abb6083f7
Andrew Gallant
2024-08-01T20:49:31
fmt/strtime: refactor to enable Extension parsing in strptime Previously, in strptime, we just skipped over ASCII digits and flags when they might appear. But in the course of trying to fix #62, it looks like we're going to want to have parsing respect padding settings. So this commit refactors parsing to actually ext...
diff --git a/src/fmt/strtime/format.rs b/src/fmt/strtime/format.rs index 391163d..49f770e 100644 --- a/src/fmt/strtime/format.rs +++ b/src/fmt/strtime/format.rs @@ -5,7 +5,7 @@ use crate::{ fmt::{ strtime::{ month_name_abbrev, month_name_full, weekday_name_abbrev, - weekday_name_fu...
3
113
109
34ef70c2a3d382d31e2c5f4ccf48109df09605be
Andrew Gallant
2024-07-27T12:15:12
span: improve docs for Span getters I noticed that at least [one person] was confused about what it should return. In particular, the getters on a `Span` return the individual units, and not the "total" amount of them in the entire span. This is different from how "absolute" durations work that don't keep track of the...
diff --git a/src/span.rs b/src/span.rs index e990401..62aba66 100644 --- a/src/span.rs +++ b/src/span.rs @@ -933,61 +933,223 @@ impl Span { /// Routines for accessing the individual units in a `Span`. impl Span { - /// Returns the number of years in this span. + /// Returns the number of year units in this sp...
1
172
10
a8cf3bea6e0aa923004b3aaaa6d7867557b35978
Andrew Gallant
2024-07-27T12:29:59
span: allow `ambiguous_negative_literals` This was bad timing. The lang team just stabilized (in nightly) a new deny-by-default lint, named `ambiguous_negative_literals`, which triggers an error for things like `-1.hour()`. While such things can be confusingly ambiguous in some cases, in Jiff, `-1.hour()`, `(-1).hour(...
diff --git a/src/civil/date.rs b/src/civil/date.rs index 47ef6a7..ed63536 100644 --- a/src/civil/date.rs +++ b/src/civil/date.rs @@ -1367,6 +1367,8 @@ impl Date { /// # Example: negative spans are supported /// /// ``` + /// # // See: https://github.com/rust-lang/rust/pull/121364 + /// # #![allow(u...
9
130
0