SirenOfShame.Lib.Device.SirenOfShameDevice.CalculateDurationFromTimeSpan C# (CSharp) Méthode

CalculateDurationFromTimeSpan() private méthode

private CalculateDurationFromTimeSpan ( System.TimeSpan durationTimeSpan ) : UInt16
durationTimeSpan System.TimeSpan
Résultat System.UInt16
        private UInt16 CalculateDurationFromTimeSpan(TimeSpan? durationTimeSpan)
        {
            if (durationTimeSpan == null)
            {
                return Duration_Forever;
            }
            UInt32 result = (UInt32)(durationTimeSpan.Value.TotalSeconds * 10.0);
            if (result > UInt16.MaxValue - 10)
            {
                return Duration_Forever;
            }
            return (UInt16)result;
        }