blob: c9109bdbbcd8c5098799d1e6e653ddf309cab5f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
namespace OAuthAuthorizationServer.Code {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
internal static class Utilities {
/// <summary>
/// Ensures that local times are converted to UTC times. Unspecified kinds are recast to UTC with no conversion.
/// </summary>
/// <param name="value">The date-time to convert.</param>
/// <returns>The date-time in UTC time.</returns>
internal static DateTime AsUtc(this DateTime value) {
if (value.Kind == DateTimeKind.Unspecified) {
return new DateTime(value.Ticks, DateTimeKind.Utc);
}
return value.ToUniversalTime();
}
}
}
|