iz
Clone
https://git.tahinli.com/Tahinli/iz.git
0 watching0 forksRustAGPL-3.0567.3 KiB3950aceTahinli27 days ago34 commits
| 1 | //! UTC stamps for storage. Format: RFC 3339, 9 fractional digits, `Z` suffix, always 30 characters, |
| 2 | //! so that text order is time order. Local calendar handling lives in `zones.rs`. |
| 3 | |
| 4 | use Duration; |
| 5 | |
| 6 | use |
| 7 | |
| 8 | |
| 9 | ; |
| 10 | |
| 11 | const FORMAT: & = |
| 12 | format_description!; |
| 13 | |
| 14 | /// Formats `at` as a stamp. The format only uses fields that always render, so this cannot fail. |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | /// Current time as a stamp. |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | /// The stamp of a Unix time in whole seconds (an ID token's `iat`), or `None` when it is out of range. |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | /// Parses an RFC 3339 time (any offset, any fraction length) and re-formats it as a stamp. `None` when |
| 34 | /// the text does not parse. This brings directory times into the stored form so text comparison works. |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | /// The stamp for `now + after`. Saturates at the largest representable time instead of panicking. |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | /// The stamp of the time `before` ago. Text order is time order, so `deleted_at >= stamp_before(d)` is |
| 48 | /// "deleted within the last `d`". |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 |