From 5e31f8f99a6ecf817e01b86963e4c55c0d9843e2 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Thu, 12 Nov 2026 23:48:33 +0330 Subject: [PATCH] add extensions method ... --- Extensions/CommonExtensions.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 ///