I need to know if the system time is equal to the desired one. For example, I need it to be 6:00 PM and find out if the system time is equal to 18 hours. If, for example, 15 hours, then nothing is done. And if 18, then some action is performed.
- Describe in more detail how you pass the time that needs to be compared with the system time. - Legionary
- Just take the number 18) For example, if (getCurrentHour () == 18) {doSomething (); } - Vlad
- oneif you want to do something at 18:00 every day, it is easier to use system tools such as cron, Windows task scheduler. Otherwise, you have to implement the functionality yourself: take care that your program starts up when you start the system, restart it if it ends for any reason, make sure that the program is not frozen, watch that the program that monitors your program also works. - jfs
|
1 answer
Something like this:
if (QTime::currentTime().hour() == 18){...} - Suppose> = does not roll on the basis of the TK - Hermann Zheboldov
- @HermannZheboldov and indeed, something I thought was more than 18. - Vladimir Martyanov
- It is also necessary to compare for strict equality very carefully. - KoVadim
- Fits me, thanks a lot))) - Vlad
- @Vlad recommend reading QTime documentation ;-) - Vladimir Martyanov
|