#programista15k #java
W zookeeper jest metoda Time.currentElapsedTime(), jej implementacja z tego co znalazłem to:
i w jej opisie mamy:
Czy rozumiecie ten fragment: "The difference is that if somebody changes the system clock, Time.currentElapsedTime will change but nanoTime won't." - jak wartość Time.currentElapsedTime może się zmienić w chwili, gdy wartość nanoTime się nie zmieni? ( ͡° ʖ̯ ͡°) Czy to jest niepoprawne stwierdzenie, czy ja nie umiem w #angielski albo jestem nierozumny?
#programowanie
W zookeeper jest metoda Time.currentElapsedTime(), jej implementacja z tego co znalazłem to:
return System.nanoTime() / 1000000;
i w jej opisie mamy:
public static long currentElapsedTime()
Returns time in milliseconds as does System.currentTimeMillis(), but uses elapsed time from an arbitrary epoch more like System.nanoTime(). The difference is that if somebody changes the system clock, Time.currentElapsedTime will change but nanoTime won't. On the other hand, all of ZK assumes that time is measured in milliseconds.
Returns:
The time in milliseconds from some arbitrary point in time.
Czy rozumiecie ten fragment: "The difference is that if somebody changes the system clock, Time.currentElapsedTime will change but nanoTime won't." - jak wartość Time.currentElapsedTime może się zmienić w chwili, gdy wartość nanoTime się nie zmieni? ( ͡° ʖ̯ ͡°) Czy to jest niepoprawne stwierdzenie, czy ja nie umiem w #angielski albo jestem nierozumny?
#programowanie
- Najlepsze
- Wszystkie komentarze






Tak by wychodziło z opisu
"Time.currentElapsedTime will change but nanoTime won't"powinno być"Time.currentElapsedTime will change but currentTimeMillis won't". Wtedy wszystko będzie się zgadzać.@sosna119: a więc jeśli nanoTime jest niewrażliwe, to jak powyższe wyrażenie (czyli implementacja metody currentElapsedTime()) może być wrażliwe?