File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
src/main/scala/li/cil/oc/server/machine Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 11## Fixes/improvements
22
3+ * [ #3621 ] Fix ` os.time() ` being off by one hour
34* [ #3682 ] Add error handling to the ` flash ` OpenOS program
45* [ #3764 ] Fix left and right names being swapped in the Rack GUI
56* [ #3779 ] Fix ` os.sleep(0) ` causing ` too long without yielding ` (Ocawesome101)
Original file line number Diff line number Diff line change @@ -67,10 +67,11 @@ class OSAPI(owner: NativeLuaArchitecture) extends NativeLuaAPI(owner) {
6767 if (lua.isNoneOrNil(1 )) {
6868 // Game time is in ticks, so that each day has 24000 ticks, meaning
6969 // one hour is game time divided by one thousand. Also, Minecraft
70- // starts days at 6 o'clock, versus the 1 o'clock of timestamps so we
71- // add those five hours. Thus:
72- // timestamp = (time + 5000) * 60[kh] * 60[km] / 1000[s]
73- lua.pushNumber(((machine.worldTime + 5000 ) * 60 * 60 ) / 1000.0 )
70+ // starts days at 6 o'clock; os.time() reflects UTC while os.date()
71+ // reflects the local time zone, but Minecraft has no concept of
72+ // time zones, so this detail can be ignored. Thus:
73+ // timestamp = (time + 6000) * 60[kh] * 60[km] / 1000[s]
74+ lua.pushNumber(((machine.worldTime + 6000 ) * 60 * 60 ) / 1000.0 )
7475 }
7576 else {
7677 def getField (key : String , d : Int ) = {
Original file line number Diff line number Diff line change @@ -51,10 +51,11 @@ class OSAPI(owner: LuaJLuaArchitecture) extends LuaJAPI(owner) {
5151 if (args.isnoneornil(1 )) {
5252 // Game time is in ticks, so that each day has 24000 ticks, meaning
5353 // one hour is game time divided by one thousand. Also, Minecraft
54- // starts days at 6 o'clock, versus the 1 o'clock of timestamps so we
55- // add those five hours. Thus:
56- // timestamp = (time + 5000) * 60[kh] * 60[km] / 1000[s]
57- LuaValue .valueOf((machine.worldTime + 5000 ) * 60 * 60 / 1000 )
54+ // starts days at 6 o'clock; os.time() reflects UTC while os.date()
55+ // reflects the local time zone, but Minecraft has no concept of
56+ // time zones, so this detail can be ignored. Thus:
57+ // timestamp = (time + 6000) * 60[kh] * 60[km] / 1000[s]
58+ LuaValue .valueOf((machine.worldTime + 6000 ) * 60 * 60 / 1000 )
5859 }
5960 else {
6061 val table = args.checktable(1 )
You can’t perform that action at this time.
0 commit comments