如何在C中实现反向计时器? [英] How to implement a backcountimg timer in C?
本文介绍了如何在C中实现反向计时器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用ETAS的INCA工具进行校准和测量测试。我有一个测量窗口来显示变量的值。当我暂停测量并再次想要以相同的时间间隔开始时,我无法做到。它需要通用系统时间并从该时间间隔再次播放。那么,我该如何实现Backcounting计时器呢?任何帮助将不胜感激。
我尝试过:
我真的没有任何想法尝试
I am working on calibrations and measurements tests using a tool INCA from ETAS. I have a measure window to Display the values of variables. When I pause the measurement and again want to start at the same time interval, I am unable to do. It takes the universal System time and Plays again from that time interval. So, how can I implement a Backcounting timer? Any help would be appreciated.
What I have tried:
I really do not have any idea to try
推荐答案
这是你的设计问题。通常是实施一些类设计以增强清晰度。我猜你需要一个函数RestartTimer来创建一个全新的计时器。
通过计算结束时间(将来)完成反向计时计时器并减去实际时间。
在Windows中你有 SetTimer ,通常在1秒间隔内用于更新用户界面。重要的是要知道你不能依赖那个区间的精度,所以用自己的时间变量来计算你的区间!!!
It is a problem of your design. Normally is some class design implemented which enhances clarity. I guess you need a function "RestartTimer" which creates a brand new timer.
A backcounting timer is done by calculating the end time (in the future) and substract the actual time.
In Windows you have the SetTimer which is normally used in 1 second interval to update the user interface. Important is to know that you cant rely on the precision of that interval, so calculate your interval in own time variables!!!
这篇关于如何在C中实现反向计时器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文