Although the Date class is intended to reflect coordinated universal time (UTC), it may not do so exactly, depending on the host environment of the Java Virtual Machine. Nearly all modern operating systems assume that 1 day = 24 × 60 × 60 = 86400 seconds in all cases. In UTC, however, about once every year or two there is an extra second, called a "leap second." The leap second is always added as the last second of the day, and always on December 31 or June 30. For example, the last minute of the year 1995 was 61 seconds long, thanks to an added leap second. Most computer clocks are not accurate enough to be able to reflect the leap-second distinction.
wtf... jadi apa ga mungkin menghitung hari dg operasi aritmatika biasa?
sebelumnya code gw h+1
long nextDay = now + 1000 * 60 *60 * 24;
apa clock di BIOS support UTC?
atau OS yg support UTC apa?
apa programming language skr sudah aware dg UTC ini? :(
atau... kita lupakan saja UTC ini & anggap ia ga ada?
bagaimana contoh kasus dari akibat kesalahan ini?
cuma second aja, damagenya kekna kgk significant. unless sampai time critical sekali dan ada jalan di akhir tahun yg bisa sampe geser 1 detik pindah tahun
Quote from: Indra on 03 January 2010, 04:10:59 PM
bagaimana contoh kasus dari akibat kesalahan ini?
kalau ada system yg pake UTC tidak akurat sedikit bro...
mis gw lagi hitung faktur yg harus ditagih sampe 5 hari ke depan.
biasanya gw hitungnya : now + 5 * 1000 * 60 * 60 * 24 (kalau di Delphi gitu ;))
selagi semua pake system UT seh ga masalah,
kalau ada yg pake system UTC dan pas dalam 5 hari itu ada leap second,
maka tidak akurat sedikit sekali, jd harusnya begini:
now + 5 * 1000 * 60 * 60 24 +
leap_second * 1000;
tidak fatal sih, makanya saya tanya...
apa programmer tidak perlu memusingkan hal ini?