Pi icon indicating copy to clipboard operation
Pi copied to clipboard

Is implementation of TimeSpanUtility.FromMicroseconds wrong?

Open hugener opened this issue 8 years ago • 0 comments

Is it me or is this wrong? https://github.com/Petermarcu/Pi/blob/bf6c6234c19819095aa773cd997dc9dec5eea71e/Pi.System/Timers/TimeSpanUtility.cs#L15-L18

It seems to me anything less that 10 microseconds will give 0. TimeSpan has 10000 ticks per millisecond => 10 ticks per microsecond, so I would more expect something like:

public static TimeSpan FromMicroseconds(double microseconds) { return TimeSpan.FromTicks((long)(microseconds * 10)); }

hugener avatar Feb 24 '18 23:02 hugener