您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
23 行
543 B
23 行
543 B
using System;
|
|
|
|
namespace Unity.Services.Authentication.Utilities
|
|
{
|
|
interface IDateTimeWrapper
|
|
{
|
|
double SecondsSinceUnixEpoch();
|
|
|
|
DateTime UtcNow { get; }
|
|
}
|
|
|
|
class DateTimeWrapper : IDateTimeWrapper
|
|
{
|
|
static readonly DateTime k_UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
|
|
|
public double SecondsSinceUnixEpoch()
|
|
{
|
|
return Math.Round((DateTime.UtcNow - k_UnixEpoch).TotalSeconds);
|
|
}
|
|
|
|
public DateTime UtcNow => DateTime.UtcNow;
|
|
}
|
|
}
|