/// A utility function to help set the expiry time when creating an
/// SignedIngress message from scratch.  Returns the current time and expiry
/// time.  The expiry time is set from the current system time + the maximum
/// amount of time ingress messages are allowed to stay alive for - 60 seconds.
///
/// Subtracting 60 seconds is because this uses the system time and not the
/// block time. The block time is going to lag behind the system time by
/// some amount, so if you don't subtract you have an expiry time that is too
/// far in the future when the expiry time is compared against block_time +
/// MAX_INGRESS_TTL, and the message will be rejected.
///
/// 60 seconds is hopefully enough leeway.
///
///
/// WARNING: this function should not be used in any deterministic part of the
/// IC as it accesses system time, which is non-deterministic between nodes.
//
// This function is made public to be able to use it for testing purposes.
A utility function to help set the expiry time when creating an
SignedIngress message from scratch.  Returns the current time and expiry
time.  The expiry time is set from the current system time + the maximum
amount of time ingress messages are allowed to stay alive for - 60 seconds.

Subtracting 60 seconds is because this uses the system time and not the
block time. The block time is going to lag behind the system time by
some amount, so if you don't subtract you have an expiry time that is too
far in the future when the expiry time is compared against block_time +
MAX_INGRESS_TTL, and the message will be rejected.

60 seconds is hopefully enough leeway.

this function should not be used in any deterministic part of the
IC as it accesses system time, which is non-deterministic between nodes.

This function is made public to be able to use it for testing purposes.
A utility function to help set the expiry time when creating an SignedIngress message from scratch . Returns the current time and expiry time . The expiry time is set from the current system time + the maximum amount of time ingress messages are allowed to stay alive for - 60 seconds . Subtracting 60 seconds is because this uses the system time and not the block time . The block time is going to lag behind the system time by some amount so if you don ' t subtract you have an expiry time that is too far in the future when the expiry time is compared against block_time + MAX_INGRESS_TTL and the message will be rejected . 60 seconds is hopefully enough leeway . this function should not be used in any deterministic part of the IC as it accesses system time which is non - deterministic between nodes . This function is made public to be able to use it for testing purposes .
pub fn current_time_and_expiry_time() -> (Time, Time) {
    let start = std::time::SystemTime::now();
    let since_epoch = start
        .duration_since(std::time::UNIX_EPOCH)
        .expect("Time wrapped around");
    (
        UNIX_EPOCH + since_epoch,
        UNIX_EPOCH + (since_epoch + MAX_INGRESS_TTL - PERMITTED_DRIFT),
    )
}
pub fn current_time_and_expiry_time ( ) -> ( Time , Time ) { let start = std :: time :: SystemTime :: now ( ) ; let since_epoch = start . duration_since ( std :: time :: UNIX_EPOCH ) . expect ( " " ) ; ( UNIX_EPOCH + since_epoch , UNIX_EPOCH + ( since_epoch + MAX_INGRESS_TTL - PERMITTED_DRIFT ) , ) }
A utility function to help set the expiry time when creating an
SignedIngress message from scratch.
A utility function to help set the expiry time when creating an SignedIngress message from scratch .