private static DateTime GetTimeAsDateTime(string expiryTime)
{
long totalSeconds;
if (!long.TryParse(expiryTime, out totalSeconds))
{
throw new ArgumentOutOfRangeException(nameof(expiryTime), "Invalid expiry time. Expected the time to be in seconds passed from 1 January 1970.");
}
var maxSeconds = (long)(DateTime.MaxValue - _swtBaseTime).TotalSeconds - 1;
if (totalSeconds > maxSeconds)
{
totalSeconds = maxSeconds;
}
return ToDateTimeFromEpoch(totalSeconds);
}
}