v1
This commit is contained in:
21
OrpaonVision.Core/Abstractions/IClock.cs
Normal file
21
OrpaonVision.Core/Abstractions/IClock.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace OrpaonVision.Core.Abstractions;
|
||||
|
||||
/// <summary>
|
||||
/// 时间服务抽象。
|
||||
///
|
||||
/// 用途:
|
||||
/// - 消除业务代码对 DateTime.Now 的直接依赖;
|
||||
/// - 提升可测试性,便于通过替身时间源复现时序问题。
|
||||
/// </summary>
|
||||
public interface IClock
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取当前本地时间。
|
||||
/// </summary>
|
||||
DateTime Now { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前 UTC 时间。
|
||||
/// </summary>
|
||||
DateTime UtcNow { get; }
|
||||
}
|
||||
Reference in New Issue
Block a user