diff --git a/Extensions/CommonExtensions.cs b/Extensions/CommonExtensions.cs index 4f29a0f..b11a300 100644 --- a/Extensions/CommonExtensions.cs +++ b/Extensions/CommonExtensions.cs @@ -1628,6 +1628,26 @@ namespace xCommons.Extensions return time.IsExPired(); } + /// + /// Check Specified Time is Expired or not ... + /// + /// + /// + /// + public static bool IsExpiredTTL( + this DateTime source, + int ttlSeconds + ) + { + // + var now = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); + var result = new DateTimeOffset(source) + .ToUnixTimeSeconds() < now + ttlSeconds; + + // + return result; + } + /// /// Determines a File Type is Image Kind or not ///