Assets/Scripts/BIP39/Utilities.cs
/// <summary>
/// Checks to see if supplied time is within the 70 minute tollerance for network error
/// </summary>
/// <param name="peerUnixTime">Unix time to check within threshold</param>
/// <param name="timeOffset">Offset which is difference between peerUnixTime and local UTC time</param>
/// <returns>Compliance within threshold</returns>
Checks to see if supplied time is within the 70 minute tollerance for network error
Checks to see if supplied time is within the 70 minute tollerance for network error
public static bool UnixTimeWithin70MinuteThreshold(ulong peerUnixTime, out long timeOffset)
        {
            int maxOffset = 42000;
            int minOffset = -42000;
            ulong currentTime = ToUnixTime(DateTime.UtcNow);
            timeOffset = (Convert.ToInt64(currentTime)) - (Convert.ToInt64(peerUnixTime));
            if (timeOffset > maxOffset || timeOffset < minOffset)
            {
                return false;
            }
            return true;
        }
public static bool UnixTimeWithin70MinuteThreshold ( ulong peerUnixTime , out long timeOffset ) { int maxOffset = 42000 ; int minOffset = - 42000 ; ulong currentTime = ToUnixTime ( DateTime . UtcNow ) ; timeOffset = ( Convert . ToInt64 ( currentTime ) ) - ( Convert . ToInt64 ( peerUnixTime ) ) ; if ( timeOffset > maxOffset || timeOffset < minOffset ) { return false ; } return true ; }
Checks to see if supplied time is within the 70 minute tollerance for network error
Checks to see if supplied time is within the 70 minute tollerance for network error
Compliance within threshold
Compliance within threshold
peerUnixTime
ulong
Unix time to check within threshold
Unix time to check within threshold
long
out
timeOffset
Offset which is difference between peerUnixTime and local UTC time
Offset which is difference between peerUnixTime and local UTC time