File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ fn main() {
83
83
. allowlist_function ( "floor_to_epoch" )
84
84
. allowlist_function ( "glo2gps" )
85
85
. allowlist_function ( "gps2glo" )
86
+ . allowlist_function ( "mjd2gps" )
86
87
. allowlist_var ( "FLOAT_EQUALITY_EPS" )
87
88
. allowlist_var ( "MINUTE_SECS" )
88
89
. allowlist_var ( "HOUR_SECS" )
Original file line number Diff line number Diff line change @@ -728,6 +728,21 @@ impl UtcTime {
728
728
self . seconds( )
729
729
)
730
730
}
731
+
732
+ pub fn to_gps_hardcoded ( & self ) -> GpsTime {
733
+ let is_lse = self . seconds ( ) >= 60.0 ;
734
+ let mjd = self . to_mjd ( ) ;
735
+ let gps = unsafe { swiftnav_sys:: mjd2gps ( mjd. 0 ) } ;
736
+ let gps = GpsTime ( gps) ;
737
+
738
+ // During a leap second event the MJD is wrong by a second, so remove the
739
+ // erroneous second here
740
+ if is_lse {
741
+ gps - std:: time:: Duration :: from_secs ( 1 )
742
+ } else {
743
+ gps
744
+ }
745
+ }
731
746
}
732
747
733
748
impl Default for UtcTime {
You can’t perform that action at this time.
0 commit comments