mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-05-04 18:50:23 +02:00
Fixed: Speed up parsing DateTime
This commit is contained in:
parent
7fcd320e23
commit
4a7bf39723
1 changed files with 4 additions and 7 deletions
|
|
@ -214,16 +214,13 @@ public static DateTime FromUnknown(string str, string format = null)
|
|||
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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue