Cosmos/source/Cosmos.System2_Plugs/System/TimeSpanImpl.cs
José Pedro 92bc85c9bc
Fixed TimeSpan and DateTime.
Added tests.
2018-04-14 01:31:52 +01:00

36 lines
926 B
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;
}
}
}