如何开发一个时钟或时间控件,我想手动更改时间,它不会取决于使用C#的系统时间(DateTime.Now) [英] how to develop a clock or time control in which i want to change time manually and it wont depends on the system time(DateTime.Now) using C#

查看:110
本文介绍了如何开发一个时钟或时间控件,我想手动更改时间,它不会取决于使用C#的系统时间(DateTime.Now)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何开发一个时钟或时间控件,我想手动更改时间,它不会取决于系统时间(DateTime.Now)使用C#

how to develop a clock or time control in which i want to change time manually and it wont depends on the system time(DateTime.Now) using C#

推荐答案

我刚回答了这个问题。如果您有任何其他问题,请编辑您的问题。您可以使用计时器,但让系统时间完成它的工作更加准确,并且您只需存储您想要显示的时间偏移量,以及系统知道的时间。否则你的时间会漂移,因为Windows定时器不可靠。
I just answered this. If you have any other questions, then edit your question. You can use a timer, but it''s more precise to let the system time do it''s job and for you to just store the offset from the time you want to show, and the time the system knows. Otherwise your time can drift because windows timers are not reliable.


正如Christian所说,存储/使用偏移来计算你的应用程序的时间。如果您不想与系统时间相关联,那么我们 SNTP [ ^ ]获取实时并使用您的偏移量虽然这需要互联网连接和定期检查以保持其准确。
As Christian says, store/use an offset to calculate your application''s ''time''. If you want no tie to the system time then us SNTP[^] to get the real time and use your offset although this will require an internet connection and periodic checks to keep it accurate.


这篇关于如何开发一个时钟或时间控件,我想手动更改时间,它不会取决于使用C#的系统时间(DateTime.Now)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆