I'm writing a simple generic logger class, that is aware of time started and ended of a task that is being logged.
In English how would you rather see represented the time taken for the task to finish in various time figures?
I currently have,
Log("Finished in {0}ms, {1}s, {2}m.", ts.TotalMilliseconds, ts.TotalSeconds, ts.TotalMinutes);
Which outputs,
2012-02-16@20:12:33: Finished in 2007.8125ms, 2.0078125s, 0.0334635416666667m.
Any better ways you may suggest?
Cheers, P.
Thanks Xeno, final code is:
Log(string.Concat("Finished in ", (ts.Hours > 0 ? ts.Hours + "h " : string.Empty),
(ts.Minutes > 0 ? ts.Minutes + "m " : string.Empty),
(ts.Seconds > 0 ? ts.Seconds + "s " : string.Empty),
(ts.Milliseconds > 0 ? ts.Milliseconds + "ms " : string.Empty),
("(" + ts.TotalMilliseconds.ToString("0.000") + ")")));