You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@ -8,9 +8,17 @@ namespace System.Web.Util {
|
||||
|
||||
using System;
|
||||
|
||||
internal enum TimeUnit {
|
||||
Unknown = 0,
|
||||
Days,
|
||||
Hours,
|
||||
Minutes,
|
||||
Seconds,
|
||||
Milliseconds
|
||||
};
|
||||
|
||||
internal sealed class DateTimeUtil {
|
||||
private DateTimeUtil() {}
|
||||
|
||||
const long FileTimeOffset = 504911232000000000;
|
||||
static readonly DateTime MinValuePlusOneDay = DateTime.MinValue.AddDays(1);
|
||||
static readonly DateTime MaxValueMinusOneDay = DateTime.MaxValue.AddDays(-1);
|
||||
@ -46,6 +54,26 @@ namespace System.Web.Util {
|
||||
|
||||
return utcTime.ToLocalTime();
|
||||
}
|
||||
|
||||
static internal TimeSpan GetTimeoutFromTimeUnit(int timeoutValue, TimeUnit timeoutUnit) {
|
||||
switch (timeoutUnit) {
|
||||
case TimeUnit.Days:
|
||||
return new TimeSpan(timeoutValue, 0, 0, 0);
|
||||
case TimeUnit.Hours:
|
||||
return new TimeSpan(timeoutValue, 0, 0);
|
||||
case TimeUnit.Seconds:
|
||||
return new TimeSpan(0, 0, timeoutValue);
|
||||
case TimeUnit.Milliseconds:
|
||||
return new TimeSpan(0, 0, 0, 0, timeoutValue);
|
||||
case TimeUnit.Minutes:
|
||||
return new TimeSpan(0, timeoutValue, 0);
|
||||
case TimeUnit.Unknown:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
throw new ArgumentException(SR.GetString(SR.InvalidArgumentValue, "timeoutUnit"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user