fill the string with 0

master
Unknown 2017-10-08 20:18:33 +02:00
parent 92b975c93c
commit 4d8aa26574
1 changed files with 13 additions and 1 deletions

View File

@ -157,6 +157,18 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
#endregion #endregion
#region IMapImageGenerator Members #region IMapImageGenerator Members
public static string fillInt(int _i, int _l)
{
String _return = _i.ToString();
while(_return.Length < _l)
{
_return = 0 + _return;
}
return _return;
}
public static int getCurrentUnixTime() public static int getCurrentUnixTime()
{ {
return (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; return (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
@ -168,7 +180,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
long unixTimeStampInTicks = (long)(unixTime * TimeSpan.TicksPerSecond); long unixTimeStampInTicks = (long)(unixTime * TimeSpan.TicksPerSecond);
DateTime _date = new DateTime(unixStart.Ticks + unixTimeStampInTicks, System.DateTimeKind.Utc); DateTime _date = new DateTime(unixStart.Ticks + unixTimeStampInTicks, System.DateTimeKind.Utc);
return _date.Day + "." + _date.Month + "." + _date.Year + " " + _date.Hour + ":" + _date.Minute; return fillInt(_date.Day, 2) + "." + fillInt(_date.Month, 2) + "." + fillInt(_date.Year, 4) + " " + fillInt(_date.Hour, 2) + ":" + fillInt(_date.Minute, 2);
} }
private void writeDateOnMap(ref Bitmap _map) private void writeDateOnMap(ref Bitmap _map)