Saturday, 17 August 2013

String format error

String format error

I've coded a uptime to my application and it's just displaying random
numbers?
the program time is this code
public static DateTime TimeStarted { get; set; }
public static void Time(string[] args)
{
//set start time
Program.TimeStarted = DateTime.Now;
}
and then this is a class to display the uptime
case "uptime":
{
TimeSpan sinceStarted = (TimeSpan)(DateTime.Now - Program.TimeStarted);
double secondsRunning = sinceStarted.TotalSeconds;
string message = string.Format("{0} Days, {1} hours, and {2} minutes",
sinceStarted.Days, sinceStarted.Hours, sinceStarted.Minutes);
Session.SendData(UserAlertModernComposer.Compose("Stats", message));
return true;
}
its currently saying 735096 days 7 hours and 34 minutes when the uptime is
around 20 minutes,

No comments:

Post a Comment