using System; using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; using Windows.UI.Xaml.Data; namespace OwlCore.WinUI.Converters.Time.Numerical { /// /// A converter that converts a given to a . /// public sealed class LongToTimeSpanConverter : IValueConverter { /// /// Converts a to a . /// /// The to convert. /// A formatted string of the . [Pure] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static TimeSpan Convert(long value) => TimeSpan.FromMilliseconds(value); /// public object Convert(object value, Type targetType, object parameter, string language) { if (value is long timeSpan) { return Convert(timeSpan); } return Convert(0); } /// public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } }