0

I am getting current time via internet and I would like to make a java simple clock component with label printing time HH:MM:SS but I don't know how to increment time. I don't want to download it all the time every single second, just want to download it and increment it in app.

Indigo_heart
  • 129
  • 11
  • 1
    As a simple [example](http://stackoverflow.com/questions/27160592/java-gui-clock-using-large-amounts-of-ram/27160772#27160772) - The basic idea would be to get the time from the internet, use a `LocalDateTime` or `LocalTime` object and apply the time (from the internet to it) and then simply keep updating this at regular intervals ... or something like that – MadProgrammer Mar 22 '17 at 21:55
  • 1
    Calculate the offset from the local time, and keep applying that offset to get the current internet time. – shmosel Mar 22 '17 at 21:55
  • 1
    try to use a scheduled task (TimerTask) http://stackoverflow.com/questions/25296718/repeat-an-action-every-2-seconds-in-java if you do not need the value every x (milli)seconds, you could just subtract the current time from the old time using System.milliseconds() – Wietlol Mar 22 '17 at 21:57

0 Answers0