From 4a7bf39723f40681c6dbf905f62f6b49e24c6362 Mon Sep 17 00:00:00 2001 From: ta264 Date: Mon, 6 Dec 2021 21:57:22 +0000 Subject: [PATCH] Fixed: Speed up parsing DateTime --- src/NzbDrone.Core/Parser/DateTimeUtil.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/NzbDrone.Core/Parser/DateTimeUtil.cs b/src/NzbDrone.Core/Parser/DateTimeUtil.cs index 9bccaabe1..2e1422da8 100644 --- a/src/NzbDrone.Core/Parser/DateTimeUtil.cs +++ b/src/NzbDrone.Core/Parser/DateTimeUtil.cs @@ -214,16 +214,13 @@ namespace NzbDrone.Core.Parser return dt; } - try + // try parsing the str as an unix timestamp + if (long.TryParse(str, out var unixTimeStamp)) { - // try parsing the str as an unix timestamp - var unixTimeStamp = long.Parse(str); return UnixTimestampToDateTime(unixTimeStamp); } - catch (FormatException) - { - // it wasn't a timestamp, continue.... - } + + // it wasn't a timestamp, continue.... // add missing year match = _MissingYearRegexp.Match(str);