horologium 0.0.4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +111 -0
  3. data/README.md +383 -149
  4. data/lib/horologium/configuration.rb +92 -45
  5. data/lib/horologium/data/barycentric_model.rb +15 -29
  6. data/lib/horologium/data/eop.rb +68 -0
  7. data/lib/horologium/data/leap_seconds.rb +3 -14
  8. data/lib/horologium/duration.rb +194 -65
  9. data/lib/horologium/epochs.rb +3 -16
  10. data/lib/horologium/error.rb +27 -32
  11. data/lib/horologium/instant.rb +205 -127
  12. data/lib/horologium/interval.rb +224 -0
  13. data/lib/horologium/numeric/exact.rb +15 -18
  14. data/lib/horologium/numeric/precision.rb +91 -44
  15. data/lib/horologium/numeric/two_part_float.rb +54 -123
  16. data/lib/horologium/precise_value.rb +4 -11
  17. data/lib/horologium/representations/civil.rb +140 -123
  18. data/lib/horologium/representations/civil_time.rb +5 -40
  19. data/lib/horologium/representations/iso8601.rb +57 -95
  20. data/lib/horologium/representations/julian_date.rb +24 -85
  21. data/lib/horologium/representations/modified_julian_date.rb +15 -55
  22. data/lib/horologium/scale_reading.rb +10 -31
  23. data/lib/horologium/scales/base.rb +17 -50
  24. data/lib/horologium/scales/gps.rb +42 -0
  25. data/lib/horologium/scales/tai.rb +1 -8
  26. data/lib/horologium/scales/tcb.rb +90 -0
  27. data/lib/horologium/scales/tcg.rb +77 -0
  28. data/lib/horologium/scales/tdb.rb +2 -15
  29. data/lib/horologium/scales/tt.rb +10 -31
  30. data/lib/horologium/scales/ut1.rb +204 -0
  31. data/lib/horologium/scales/utc.rb +32 -94
  32. data/lib/horologium/version.rb +1 -1
  33. data/lib/horologium.rb +6 -0
  34. data/sig/horologium/configuration.rbs +10 -0
  35. data/sig/horologium/data/eop.rbs +13 -0
  36. data/sig/horologium/duration.rbs +24 -0
  37. data/sig/horologium/instant.rbs +21 -1
  38. data/sig/horologium/interval.rbs +39 -0
  39. data/sig/horologium/numeric/precision.rbs +10 -0
  40. data/sig/horologium/numeric/two_part_float.rbs +4 -10
  41. data/sig/horologium/representations/civil.rbs +14 -2
  42. data/sig/horologium/representations/iso8601.rbs +6 -2
  43. data/sig/horologium/representations/julian_date.rbs +2 -2
  44. data/sig/horologium/representations/modified_julian_date.rbs +1 -3
  45. data/sig/horologium/scale_reading.rbs +1 -1
  46. data/sig/horologium/scales/base.rbs +2 -0
  47. data/sig/horologium/scales/gps.rbs +15 -0
  48. data/sig/horologium/scales/tcb.rbs +25 -0
  49. data/sig/horologium/scales/tcg.rbs +19 -0
  50. data/sig/horologium/scales/tt.rbs +0 -2
  51. data/sig/horologium/scales/ut1.rbs +35 -0
  52. data/sig/horologium.rbs +6 -0
  53. metadata +23 -5
  54. data/Rakefile +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65e0d322bb82639c79c818b3c8473f507ecfcb25215c522f20d41c5ef7f5be25
4
- data.tar.gz: 1d2d822d56768a6d9383cc29a700208e03ef3e6f639460d1a99b4eb18e01e1de
3
+ metadata.gz: 2a19e4b97b786cabb64b438057f828f1eb17266cb23125fde8a93683a47310a2
4
+ data.tar.gz: d58ea6055ea4f9b85fb91c95d8d2086e8024a15ac11339ca5149f4e33d99c3ab
5
5
  SHA512:
6
- metadata.gz: b4c87cfb9449bb41e362d2596c03ff44e2907ab593c332eb37155fb833b7d8a366911eece54a0759fff1e72410599c244c82d6757d49df66edf904783115f811
7
- data.tar.gz: 3fda2d236fb3c9afaa33e921a0a3e3738518df46cefc9e10146acf590f144cdd67f4c162448fef7c2a002ba62cd74efbd45f500b069c91e8a8020341ec082f22
6
+ metadata.gz: 646319ae7ee1006a80ada4f11f6895330fa2ef8353da957a1c0bf22e9bb8b3e05721520d1b3f6f8300704eddf672dc7914315ed2d3ad86da328b42e401e02d73
7
+ data.tar.gz: 9d4f99636d816473153ca2acbafcdabea85f3cfdf6f26d652988578813d91313658108b0bc624534072ceddadb8ed2a62a45f16c940d709dab5a5708f8ebc6a4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,116 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0 - 2026-09-13
4
+
5
+ ### Breaking changes
6
+
7
+ - An ISO 8601 zone offset moves the clock face, where it used to take a count
8
+ of SI seconds off the Julian Date. `2017-01-01T00:59:60+01:00` is the leap
9
+ second at the end of 2016, read by a clock an hour ahead of UTC, and
10
+ `2016-12-31T23:59:60+01:00` is refused, because 22:59:60 is not a time
11
+ - A representation refuses an output type it does not have.
12
+ `as(:iso8601, as: :float)` answered with a String and ignored the type it
13
+ was asked for, where a Julian Date and a civil time have always refused one
14
+ they cannot produce. Leaving `as:` out asks for the type the representation
15
+ is usually read in, which is what every caller was already getting
16
+ - Remove `Numeric::TwoPartFloat.two_sum`, `.two_diff`, `.fast_two_sum`,
17
+ `.two_product` and `.split`. Each returned a value and its rounding error as
18
+ a pair, and nothing called them: the arithmetic works the value out itself
19
+ and asks only for the error. The `_error` halves they wrapped are all still
20
+ there
21
+
22
+ ### Fixes
23
+
24
+ - Stop writing warnings to a caller's stderr, which 0.0.5 set out to do and
25
+ did not finish. The six that were left came from `iers` reading its Modified
26
+ Julian Date through `Kernel#Float`, which announces a magnitude out of Float
27
+ range. The dependency asks for iers 0.3.1 now, where the size is measured
28
+ before the conversion
29
+ - Say what `ut1_horizon` guards. The published series ends with about a year
30
+ of prediction, so a reading of today is already `:extrapolated`, and
31
+ `:raise` refuses a date past the end of the series rather than every
32
+ extrapolated value. The documentation promised the second
33
+ - Write the lower bound of a UTC reading as 1961, where UTC starts.
34
+ `Instant#to` gave it as 1972, which is where whole leap seconds start, and
35
+ the bound itself has always been the earlier one
36
+
37
+ **Full Changelog**: https://github.com/rhannequin/horologium/compare/v0.0.5...v0.1.0
38
+
39
+ ## 0.0.5 - 2026-09-08
40
+
41
+ All eight scales are in, so an instant reads in any of them, and the domain
42
+ model is complete: the point, the quantity, and the span between two points.
43
+ A `Time` bridges in from the standard library, a duration scales and reads
44
+ ISO 8601, and everything the library cannot compute with is refused by name
45
+ rather than by whatever Ruby happened to raise.
46
+
47
+ ### Breaking changes
48
+
49
+ - A value the library cannot read raises `InvalidValueError` instead of
50
+ `ArgumentError`. `Error`'s promise is that a caller can rescue Horologium as
51
+ a unit, and it did not hold: a Float that was not finite came back as
52
+ `FloatDomainError` and a Symbol given to a `Duration` constructor as
53
+ `NoMethodError`. Dividing by zero is the one error left as Ruby's own
54
+ - The civil calendar is bounded above as well as below, from -4799 to 2733193,
55
+ the range ERFA documents for its calendar routines. Julian Date 5e9 used to
56
+ read back as the year 13684822 rather than being refused
57
+
58
+ ### Features
59
+
60
+ - Add `TCG` and `TCB`, the coordinate times of the Earth-centred and
61
+ barycentric frames, each running ahead of the scale it is defined on at a
62
+ rate fixed by definition and counted from 1977-01-01 00:00:00 TAI. TCG
63
+ inverts exactly at `:exact`; TCB's own edge does too, but the way to TAI
64
+ goes through TDB's floating-point model
65
+ - Add `GPS`, a fixed 19 SI seconds behind TAI, which is where it stays because
66
+ it counts SI seconds and never takes a leap second
67
+ - Add `UT1`, the scale the rotation of the Earth keeps and the only one here
68
+ that is measured rather than defined. It converts as TT minus delta T, which
69
+ is what lets it reach back to 1800: UTC is undefined before 1961 and refuses
70
+ the date, so a pre-1961 instant has a UT1 name where it can never have a UTC
71
+ one. A reading says whether the value was observed, predicted, or fitted
72
+ - Add `Configuration#eop_source`, the Earth orientation data UT1 reads, and
73
+ `#ut1_horizon`, which chooses between reading past the end of the published
74
+ data with the last known delta T and refusing to
75
+ - Add `Instant.now`, `.from_time`, `.from_unix` and `.from_offset`. A `Time`
76
+ is read in UTC and every field it carries is used, so nothing is rounded on
77
+ the way in. Unix time is read the way POSIX reads it, which is not a count
78
+ of elapsed seconds: it has no leap seconds, so reaching a UTC date costs an
79
+ extra SI second for each one inserted along the way
80
+ - Add `Duration#*` and `#/`, which scale a duration by a plain number, and
81
+ `Duration.mean`, which averages a list of them in the split
82
+ - Add `Duration.parse` and `Duration#to_iso8601`, reading and writing the
83
+ subset of ISO 8601 that is a quantity of time. Years and months are refused
84
+ because a duration cannot say how long they are; weeks are seven days
85
+ exactly but sit outside the subset all the same
86
+ - Add `Interval`, a span between two instants, with `duration`, `cover?`,
87
+ `overlap?`, `intersection` and ISO 8601 either way. It holds its start and
88
+ excludes its end, so one window runs into the next without the two
89
+ overlapping on the moment they share. Its length is elapsed SI seconds, so a
90
+ two-hour window across the 2016 leap second is 7,201 seconds long
91
+ - Add `InvalidValueError` and `InvalidIntervalError`
92
+
93
+ ### Fixes
94
+
95
+ - Refuse a number that does not fit a Float where it has to become one, rather
96
+ than carrying on with an Infinity or a zero. Building a `:standard` value
97
+ from an Integer too large for a Float used to fail later, when the Infinity
98
+ had no rational form, and scaling a duration by a number too small used to
99
+ answer with no duration at all
100
+ - Read every part of a two-part Julian Date. A NaN in either part used to
101
+ build an instant and surface later, in a reading, in a civil time, or in a
102
+ comparison
103
+ - Read UT1 back into TAI within delta T of the earliest date the data covers.
104
+ Converting out subtracts delta T, so an instant that close to the edge
105
+ landed on a UT1 coordinate just before it, and reading that back refused
106
+ - Report no overlap between a span of no time and anything, including a span
107
+ that surrounds it. It covers no instant, so there is no instant for the two
108
+ of them to share
109
+ - Stop writing warnings to stderr. `Integer#to_f` warns on its way out of
110
+ range, so the guard that refuses such a number announced it first
111
+
112
+ **Full Changelog**: https://github.com/rhannequin/horologium/compare/v0.0.4...v0.0.5
113
+
3
114
  ## 0.0.4 - 2026-09-05
4
115
 
5
116
  The epochs astronomy counts from arrive as instants, a duration reads back in