java - System.currentTimeMillis measuring time -


when use system.currenttimemillis() measure time, safe?

e.g. when time-shift happens (summer->winter time) produce error?

no, system.currenttimemillis() returns number of elapsed milliseconds since unix epoch (midnight @ start of january 1st 1970, utc). not depend on local time zone @ all.

in other words, if call once per second, always increase 1000 (the "about" due clock accuracy , impossibility of calls being exactly 1 second apart). doesn't matter if local time zone changes offset utc, or if change whole time zone - irrelevant.

in theory, leap seconds make of trickier - in practice applications can away notionally sticking fingers in ears , saying "i'm not @ home mr leap second."


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -