Cosmos/source/Cosmos.System2_Plugs/System/TimeSpanImpl.cs
2018-12-27 21:14:56 +00:00

38 lines
1 KiB
C#

using System;
using IL2CPU.API.Attribs;
namespace Cosmos.System_Plugs.System
{
[Plug(typeof(TimeSpan))]
public static class TimeSpanImpl
{
public static string ToString(ref TimeSpan aThis)
{
string time = null;
if (aThis.Ticks < 0)
{
time += '-';
}
if (aThis.Days != 0)
{
time += aThis.Days.ToString() + ".";
}
time += aThis.Hours.ToString().PadLeft(2, '0') + ":" +
aThis.Minutes.ToString().PadLeft(2, '0') + ":" +
aThis.Seconds.ToString().PadLeft(2, '0');
if ((aThis.Ticks - (long)aThis.TotalSeconds * 1000 * 10000) != 0)
{
time += "." + (aThis.Ticks - (long)aThis.TotalSeconds * 1000 * 10000).ToString().PadLeft(7, '0');
}
return time;
}
public static string ToString(ref TimeSpan aThis, string format, IFormatProvider provider) => aThis.ToString();
}
}