Server.Items.WaitTeleporter.FormatTime C# (CSharp) Méthode

FormatTime() public static méthode

public static FormatTime ( System.TimeSpan ts ) : string
ts System.TimeSpan
Résultat string
		public static string FormatTime(TimeSpan ts)
		{
			if (ts.TotalHours >= 1)
			{
				int h = (int)Math.Round(ts.TotalHours);
				return String.Format("{0} hour{1}", h, (h == 1) ? "" : "s");
			}
			else if (ts.TotalMinutes >= 1)
			{
				int m = (int)Math.Round(ts.TotalMinutes);
				return String.Format("{0} minute{1}", m, (m == 1) ? "" : "s");
			}

			int s = Math.Max((int)Math.Round(ts.TotalSeconds), 0);
			return String.Format("{0} second{1}", s, (s == 1) ? "" : "s");
		}