@@ -530,7 +530,7 @@ impl ClusterHandler for NocHandler {
530530 let status = NodeOperationalCertStatusEnum :: map ( GenCommHandler :: with_armed_failsafe (
531531 & ctx,
532532 |state, mut notify_mdns| {
533- let lkg_utc_secs = state. lkg_utc_secs ( ) ;
533+ let lkg_utc_secs = state. rtc . utc_time_best_effort ( ) / 1_000_000 ;
534534 let sess = ctx. exchange ( ) . id ( ) . session ( & mut state. sessions ) ;
535535
536536 let fabric = state. failsafe . add_noc (
@@ -621,7 +621,7 @@ impl ClusterHandler for NocHandler {
621621 let status = NodeOperationalCertStatusEnum :: map ( GenCommHandler :: with_armed_failsafe (
622622 & ctx,
623623 |state, notify_mdns| {
624- let lkg_utc_secs = state. lkg_utc_secs ( ) ;
624+ let lkg_utc_secs = state. rtc . utc_time_best_effort ( ) / 1_000_000 ;
625625 let sess = ctx. exchange ( ) . id ( ) . session ( & mut state. sessions ) ;
626626
627627 state. failsafe . update_noc (
@@ -739,6 +739,18 @@ impl ClusterHandler for NocHandler {
739739
740740 persist. remove ( fab_idx) ?;
741741
742+ // Matter Core spec §11.17.8.7: if the removed fabric is the
743+ // one that installed the TrustedTimeSource, the device SHALL
744+ // clear the attribute (and emit `MissingTrustedTimeSource`).
745+ if state. rtc . trusted_time_source ( ) . map ( |tts| tts. fab_idx ) == Some ( fab_idx) {
746+ state. rtc . set_trusted_time_source_persist (
747+ None ,
748+ persist. persist_mut ( ) ,
749+ & ctx,
750+ & ctx,
751+ ) ?;
752+ }
753+
742754 info ! ( "Removed operational fabric with local index {}" , fab_idx) ;
743755
744756 // If the removed fabric was the one that opened the current
@@ -792,7 +804,7 @@ impl ClusterHandler for NocHandler {
792804 let mut buf = [ 0u8 ; crate :: cert:: MAX_CERT_ASN1_LEN ] ;
793805
794806 GenCommHandler :: with_armed_failsafe ( & ctx, |state, _| {
795- let lkg_utc_secs = state. lkg_utc_secs ( ) ;
807+ let lkg_utc_secs = state. rtc . utc_time_best_effort ( ) / 1_000_000 ;
796808 let sess = ctx. exchange ( ) . id ( ) . session ( & mut state. sessions ) ;
797809
798810 state. failsafe . add_trusted_root_cert (
0 commit comments