Can you round a .NET TimeSpan object?
I have a Timespan value of: 00:00:00.6193789
Is there a simple way to keep it a TimeSp
TimeSpan is little more than a wrapper around the 'Ticks' member. It's pretty easy to create a new TimeSpan from a rounded version of another TimeSpan's Ticks.
TimeSpan t1 = new TimeSpan(2345678);
Console.WriteLine(t1);
TimeSpan t2 = new TimeSpan(t1.Ticks - (t1.Ticks % 100000));
Console.WriteLine(t2);
Gives:
00:00:00.2345678
00:00:00.2300000