RaspberryIO_26/Swan.Lite/Threading/AtomicDateTime.cs

27 lines
752 B
C#
Raw Normal View History

2019-12-04 18:57:18 +01:00
using System;
namespace Swan.Threading
{
/// <summary>
/// Defines an atomic DateTime.
/// </summary>
public sealed class AtomicDateTime : AtomicTypeBase<DateTime>
{
/// <summary>
/// Initializes a new instance of the <see cref="AtomicDateTime"/> class.
/// </summary>
/// <param name="initialValue">The initial value.</param>
public AtomicDateTime(DateTime initialValue)
: base(initialValue.Ticks)
{
// placeholder
}
/// <inheritdoc />
protected override DateTime FromLong(long backingValue) => new DateTime(backingValue);
/// <inheritdoc />
protected override long ToLong(DateTime value) => value.Ticks;
}
}