mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-11 12:15:35 +08:00
feat: 增加晚点未定功能
This commit is contained in:
14
CRSim.Core/Models/Simulator/TrainStatus.cs
Normal file
14
CRSim.Core/Models/Simulator/TrainStatus.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace CRSim.Core.Models
|
||||
{
|
||||
public static class TrainStatus
|
||||
{
|
||||
// 00:00:01 is reserved for "delay unknown"; normal input/export paths only use minute precision.
|
||||
public static readonly TimeSpan DelayUnknown = TimeSpan.FromSeconds(1);
|
||||
|
||||
public static bool IsDelayUnknown(TimeSpan? status) =>
|
||||
status.HasValue && status.Value == DelayUnknown;
|
||||
|
||||
public static TimeSpan GetScheduleOffset(TimeSpan? status) =>
|
||||
IsDelayUnknown(status) ? TimeSpan.Zero : status ?? TimeSpan.Zero;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user