开发者

Multiple System Time Clock

I'm looking for a way to have multiple time clocks running along side the system time clock that are also accessible programatically so that I could access their time values much like I can system time with C#. 开发者_如何学编程A third party framework is acceptable. Anyone have any ideas, or even heard of such a need?


This might be totally off but why not just use the system clock as is and store offsets for your 'other clocks' (not sure what you are trying to do exactly) and wrappers to make them work similar? Still one clock, just different views to give different perspectives.


System.Diagnostics.Stopwatch might be what you're looking for.

// Start the Stopwatch
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
// do something...

// perhaps the rest of this could be in a method
TimeSpan ts = stopWatch.Elapsed;
return ts.TotalMilliseconds

You could keep multiple Stopwatch instances and use the TotalMilliseconds as a sort of independent "system" time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜