File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 1+ name : Update Leap Seconds
2+ on :
3+ schedule :
4+ - cron : 0 0 * * 1
5+
6+ jobs :
7+ update :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - uses : actions/checkout@v4
11+ with :
12+ fetch-depth : 0
13+ - name : Update leap seconds in code
14+ run : |
15+ curl -o leap_seconds_list -L https://data.iana.org/time-zones/data/leap-seconds.list
16+ number=$(grep -v '^#' leap_seconds_list | tail -n1 | awk '{print $2}')
17+ sed -i "s/\(1970-01-01 00:00:\)[0-9]\+ TAI/\1${number} TAI/" tai64/src/lib.rs
18+ sed -i -E 's/(Self\()[0-9]+ \+ \(1 << 62\)\)/\1'"${number}"' + (1 << 62))/' tai64/src/lib.rs
19+ rm leap_seconds_list
20+ - name : Create Pull Request
21+ uses : peter-evans/create-pull-request@v7
22+ with :
23+ commit-message : update leap seconds in tai64
24+ title : Update leap seconds in tai64
25+ body : ' Following this source: https://data.iana.org/time-zones/data/leap-seconds.list, the leap seconds counter has been updated.'
26+ branch : update-leap-seconds
27+ base : master
28+ delete-branch : true
Original file line number Diff line number Diff line change @@ -36,8 +36,8 @@ const NANOS_PER_SECOND: u32 = 1_000_000_000;
3636pub struct Tai64 ( pub u64 ) ;
3737
3838impl Tai64 {
39- /// Unix epoch in `TAI64`: 1970-01-01 00:00:10 TAI.
40- pub const UNIX_EPOCH : Self = Self ( 10 + ( 1 << 62 ) ) ;
39+ /// Unix epoch in `TAI64`: 1970-01-01 00:00:37 TAI.
40+ pub const UNIX_EPOCH : Self = Self ( 37 + ( 1 << 62 ) ) ;
4141
4242 /// Length of serialized `TAI64` timestamp in bytes.
4343 pub const BYTE_SIZE : usize = 8 ;
@@ -151,7 +151,7 @@ impl Zeroize for Tai64N {
151151}
152152
153153impl Tai64N {
154- /// Unix epoch in `TAI64N`: 1970-01-01 00:00:10 TAI.
154+ /// Unix epoch in `TAI64N`: 1970-01-01 00:00:37 TAI.
155155 pub const UNIX_EPOCH : Self = Self ( Tai64 :: UNIX_EPOCH , 0 ) ;
156156
157157 /// Length of serialized `TAI64N` timestamp.
You can’t perform that action at this time.
0 commit comments