Independent time in java application
pI would like to set arbitrary time in application. Time is downloaded
from server in milliseconds format- it should be independent from
codelocale/code and other system preferences. But application reacquire
thread safety solution, and object like standard not thread safety
codeCalendar/code object./p pWhats is the best way?/p pToday I use:/p
precodeCalendar calendar =
Calendar.getInstance(TimeZone.getTimeZone(UTC));
calendar.setTimeInMillis(serverTime); /code/pre pBut is not good way for
me beacuse, is't thread safe./p pstrongtl;dr/strong Program have to
contain own internal clock fetching time from external server. Clock must
be thread-safe./p
No comments:
Post a Comment