mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-08-03 11:07:23 -04:00
fix #3621
This commit is contained in:
parent
5d35d7f9e1
commit
a31f90a088
@ -1,5 +1,6 @@
|
||||
## Fixes/improvements
|
||||
|
||||
* [#3621] Fix `os.time()` being off by one hour
|
||||
* [#3682] Add error handling to the `flash` OpenOS program
|
||||
* [#3764] Fix left and right names being swapped in the Rack GUI
|
||||
* [#3779] Fix `os.sleep(0)` causing `too long without yielding` (Ocawesome101)
|
||||
|
@ -67,10 +67,11 @@ class OSAPI(owner: NativeLuaArchitecture) extends NativeLuaAPI(owner) {
|
||||
if (lua.isNoneOrNil(1)) {
|
||||
// Game time is in ticks, so that each day has 24000 ticks, meaning
|
||||
// one hour is game time divided by one thousand. Also, Minecraft
|
||||
// starts days at 6 o'clock, versus the 1 o'clock of timestamps so we
|
||||
// add those five hours. Thus:
|
||||
// timestamp = (time + 5000) * 60[kh] * 60[km] / 1000[s]
|
||||
lua.pushNumber(((machine.worldTime + 5000) * 60 * 60) / 1000.0)
|
||||
// starts days at 6 o'clock; os.time() reflects UTC while os.date()
|
||||
// reflects the local time zone, but Minecraft has no concept of
|
||||
// time zones, so this detail can be ignored. Thus:
|
||||
// timestamp = (time + 6000) * 60[kh] * 60[km] / 1000[s]
|
||||
lua.pushNumber(((machine.worldTime + 6000) * 60 * 60) / 1000.0)
|
||||
}
|
||||
else {
|
||||
def getField(key: String, d: Int) = {
|
||||
|
@ -51,10 +51,11 @@ class OSAPI(owner: LuaJLuaArchitecture) extends LuaJAPI(owner) {
|
||||
if (args.isnoneornil(1)) {
|
||||
// Game time is in ticks, so that each day has 24000 ticks, meaning
|
||||
// one hour is game time divided by one thousand. Also, Minecraft
|
||||
// starts days at 6 o'clock, versus the 1 o'clock of timestamps so we
|
||||
// add those five hours. Thus:
|
||||
// timestamp = (time + 5000) * 60[kh] * 60[km] / 1000[s]
|
||||
LuaValue.valueOf((machine.worldTime + 5000) * 60 * 60 / 1000)
|
||||
// starts days at 6 o'clock; os.time() reflects UTC while os.date()
|
||||
// reflects the local time zone, but Minecraft has no concept of
|
||||
// time zones, so this detail can be ignored. Thus:
|
||||
// timestamp = (time + 6000) * 60[kh] * 60[km] / 1000[s]
|
||||
LuaValue.valueOf((machine.worldTime + 6000) * 60 * 60 / 1000)
|
||||
}
|
||||
else {
|
||||
val table = args.checktable(1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user