Readded getMinecraftTime.

This commit is contained in:
FrozenCow 2011-02-13 23:30:19 +01:00
parent 3980ebefa1
commit 42391cc4d5

View File

@ -77,3 +77,20 @@ function getMinecraftHead(player,size,completed) {
completed(resizeImage(head,size));
}
}
function getMinecraftTime(servertime) {
servertime = parseInt(servertime);
var day = servertime >= 0 && servertime < 13700;
return {
servertime: servertime,
days: parseInt((servertime+8000) / 24000),
// Assuming it is day at 8:00
hours: (parseInt(servertime / 1000)+8) % 24,
minutes: parseInt(((servertime / 1000) % 1) * 60),
seconds: parseInt(((((servertime / 1000) % 1) * 60) % 1) * 60),
day: day,
night: !day
};
}