usestd::time::SystemTime;/// A struct that represents a time-based lock mechanism, which tracks an expiration time
/// and provides functionality to check if the lock has expired.
pubstructTimeLock{pubexpiry: SystemTime, // The point in time when the lock will expire
pubexpired:bool, // A boolean flag indicating whether the lock has expired
}implTimeLock{/// Checks if the TimeLock has expired by comparing the current system time with the expiration time.
/// Once the lock has expired, it will set the `expired` flag to `true` and return the result.
////// # Returns
/// * `true` if the lock has expired, `false` otherwise.
pubfnis_expired(&mutself)->bool{// If the lock has not expired yet and the current time is past the expiry time, mark it as expired
if!self.expired &&SystemTime::now()>=self.expiry {self.expired =true;}self.expired
}}