mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Standardise time display formats across the editor
This commit is contained in:
26
osu.Game/Extensions/EditorDisplayExtensions.cs
Normal file
26
osu.Game/Extensions/EditorDisplayExtensions.cs
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Extensions
|
||||
{
|
||||
public static class EditorDisplayExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Get an editor formatted string (mm:ss:mss)
|
||||
/// </summary>
|
||||
/// <param name="milliseconds">A time value in milliseconds.</param>
|
||||
/// <returns>An editor formatted display string.</returns>
|
||||
public static string ToEditorFormattedString(this double milliseconds) =>
|
||||
ToEditorFormattedString(TimeSpan.FromMilliseconds(milliseconds));
|
||||
|
||||
/// <summary>
|
||||
/// Get an editor formatted string (mm:ss:mss)
|
||||
/// </summary>
|
||||
/// <param name="timeSpan">A time value.</param>
|
||||
/// <returns>An editor formatted display string.</returns>
|
||||
public static string ToEditorFormattedString(this TimeSpan timeSpan) =>
|
||||
$"{(timeSpan < TimeSpan.Zero ? "-" : string.Empty)}{timeSpan:mm\\:ss\\:fff}";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user