@@ -971,7 +971,7 @@ where
971971 & group_id,
972972 current_epoch,
973973 & event. id ,
974- event. created_at . as_u64 ( ) ,
974+ event. created_at . as_secs ( ) ,
975975 ) {
976976 tracing:: warn!(
977977 target: "mdk_core::messages::process_commit_message_for_group" ,
@@ -1155,24 +1155,24 @@ where
11551155 let now = Timestamp :: now ( ) ;
11561156
11571157 // Reject events from the future (allow configurable clock skew)
1158- if event. created_at . as_u64 ( )
1158+ if event. created_at . as_secs ( )
11591159 > now
1160- . as_u64 ( )
1160+ . as_secs ( )
11611161 . saturating_add ( self . config . max_future_skew_secs )
11621162 {
11631163 return Err ( Error :: InvalidTimestamp ( format ! (
11641164 "event timestamp {} is too far in the future (current time: {})" ,
1165- event. created_at. as_u64 ( ) ,
1166- now. as_u64 ( )
1165+ event. created_at. as_secs ( ) ,
1166+ now. as_secs ( )
11671167 ) ) ) ;
11681168 }
11691169
11701170 // Reject events that are too old (configurable via MdkConfig)
1171- let min_timestamp = now. as_u64 ( ) . saturating_sub ( self . config . max_event_age_secs ) ;
1172- if event. created_at . as_u64 ( ) < min_timestamp {
1171+ let min_timestamp = now. as_secs ( ) . saturating_sub ( self . config . max_event_age_secs ) ;
1172+ if event. created_at . as_secs ( ) < min_timestamp {
11731173 return Err ( Error :: InvalidTimestamp ( format ! (
11741174 "event timestamp {} is too old (minimum acceptable: {})" ,
1175- event. created_at. as_u64 ( ) ,
1175+ event. created_at. as_secs ( ) ,
11761176 min_timestamp
11771177 ) ) ) ;
11781178 }
@@ -1401,7 +1401,7 @@ where
14011401 & group. mls_group_id ,
14021402 mls_group. epoch ( ) . as_u64 ( ) ,
14031403 & event. id ,
1404- event. created_at . as_u64 ( ) ,
1404+ event. created_at . as_secs ( ) ,
14051405 )
14061406 . is_err ( )
14071407 {
@@ -1630,7 +1630,7 @@ where
16301630 self . storage ( ) ,
16311631 & group. mls_group_id ,
16321632 msg_epoch,
1633- event. created_at . as_u64 ( ) ,
1633+ event. created_at . as_secs ( ) ,
16341634 & event. id ,
16351635 ) ;
16361636
@@ -3165,9 +3165,9 @@ mod tests {
31653165 ) ;
31663166
31673167 // Allow for some clock skew, but message shouldn't be more than a day old
3168- let one_day_ago = now. as_u64 ( ) . saturating_sub ( 86400 ) ;
3168+ let one_day_ago = now. as_secs ( ) . saturating_sub ( 86400 ) ;
31693169 assert ! (
3170- message_event. created_at. as_u64 ( ) > one_day_ago,
3170+ message_event. created_at. as_secs ( ) > one_day_ago,
31713171 "Message timestamp should be recent"
31723172 ) ;
31733173 }
@@ -6562,7 +6562,7 @@ mod tests {
65626562 . expect ( "Group should exist" ) ;
65636563
65646564 // Set timestamp to far future (1 hour ahead, beyond 5 minute skew allowance)
6565- let future_time = nostr:: Timestamp :: now ( ) . as_u64 ( ) + 3600 ;
6565+ let future_time = nostr:: Timestamp :: now ( ) . as_secs ( ) + 3600 ;
65666566
65676567 // Create an event with future timestamp
65686568 let message_event = EventBuilder :: new ( Kind :: MlsGroupMessage , "test content" )
@@ -6597,7 +6597,7 @@ mod tests {
65976597 . expect ( "Group should exist" ) ;
65986598
65996599 // Set timestamp to 46 days ago (beyond 45 day limit)
6600- let old_time = nostr:: Timestamp :: now ( ) . as_u64 ( ) . saturating_sub ( 46 * 86400 ) ;
6600+ let old_time = nostr:: Timestamp :: now ( ) . as_secs ( ) . saturating_sub ( 46 * 86400 ) ;
66016601
66026602 // Create an event with old timestamp
66036603 let message_event = EventBuilder :: new ( Kind :: MlsGroupMessage , "test content" )
0 commit comments