From 4d8aa26574b2b34530dc6c20fbb296b3fb31b25c Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 8 Oct 2017 20:18:33 +0200 Subject: [PATCH] fill the string with 0 --- src/Warp3DImageModule.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Warp3DImageModule.cs b/src/Warp3DImageModule.cs index 0124dc5..213ac11 100644 --- a/src/Warp3DImageModule.cs +++ b/src/Warp3DImageModule.cs @@ -157,6 +157,18 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap #endregion #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() { 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); 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)