RaspberryIO_26/Swan.Lite/Threading/AtomicTimeSpan.cs

23 lines
720 B
C#
Raw Permalink Normal View History

2019-12-04 18:57:18 +01:00
using System;
2019-12-08 19:54:52 +01:00
namespace Swan.Threading {
/// <summary>
/// Represents an atomic TimeSpan type.
/// </summary>
public sealed class AtomicTimeSpan : AtomicTypeBase<TimeSpan> {
2019-12-04 18:57:18 +01:00
/// <summary>
2019-12-08 19:54:52 +01:00
/// Initializes a new instance of the <see cref="AtomicTimeSpan" /> class.
2019-12-04 18:57:18 +01:00
/// </summary>
2019-12-08 19:54:52 +01:00
/// <param name="initialValue">The initial value.</param>
public AtomicTimeSpan(TimeSpan initialValue) : base(initialValue.Ticks) {
// placeholder
}
/// <inheritdoc />
protected override TimeSpan FromLong(Int64 backingValue) => TimeSpan.FromTicks(backingValue);
/// <inheritdoc />
protected override Int64 ToLong(TimeSpan value) => value.Ticks < 0 ? 0 : value.Ticks;
}
2019-12-04 18:57:18 +01:00
}