WPF Timer problem… Cannot get correct millisecond tick

前端 未结 3 1784
-上瘾入骨i
-上瘾入骨i 2020-12-04 02:56

I have a basic question regarding timers. My timer is acting very strange. I am trying to make the tick occur every millisecond to update my data. I can get it to work with

3条回答
  •  一生所求
    2020-12-04 03:31

    DispatcherTimer is not an high precision timer - it's a low precision low accuracy timer suitable for UI work (where people don't notice delays of 100ms).

    A high precision timers that execute code every 1ms is very difficult, maybe even impossible, to implement (what do you do if some other process in the system goes to 100% CPU and your process doesn't run for over 1ms? what do you do if the code executed by the time has to be reloaded from the page file and it takes more than 1ms?).

提交回复
热议问题