mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 04:18:43 +00:00
36 lines
926 B
C#
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;
|
|
}
|
|
}
|
|
}
|