A style question Code Golf
I've done a console program to show the hours, only hours different from what we know - and involves a It's very simple.
It checks the system time, and when it finds that a minute has passed, it prints the current time calculated on the screen.
Examples of its output:
35.5787037037037
35.69444444444444
36.388888888888886
However, I would like it to work a little better:
I would like it to have the accuracy of a second, or a .beat
To do this, I should be able to create a task linked to the system clock, so that it warned me precisely when I determined it.
I know it's possible to do an infinite loop , and check the system time thousands of times - but I do not really like the idea. The ideal would be to have a listener that would inform me that it is time to perform my task.
Is this possible? How to make? (Is there any magic, voodoo that will allow this?)
- I would like simple examples, in different languages
- Console program
- No need to implement the .beat account
- The idea is to free the program to do other things and have the task started at a precise moment in time
- One language per response!
The account, for those who are curious, is this:
(UTC+1segundos + (UTC+1minutos * 60) + (UTC+1horas * 3600)) / 86.4