os.date("*t") hour field should be "0-23" not "0-11"
Brought to you by:
ian_farmer,
jim_roseborough
hour field returned by os.date("*t") takes value from 0 to 11 but it should be 0-23.
Here is the patch for luaj 3.0.
--- src/core/org/luaj/vm2/lib/OsLib.java.org 2015-03-17 20:35:52.000000000 +0900 +++ src/core/org/luaj/vm2/lib/OsLib.java 2015-03-17 20:36:16.000000000 +0900 @@ -150,7 +150,7 @@ tbl.set("year", LuaValue.valueOf(d.get(Calendar.YEAR))); tbl.set("month", LuaValue.valueOf(d.get(Calendar.MONTH)+1)); tbl.set("day", LuaValue.valueOf(d.get(Calendar.DAY_OF_MONTH))); - tbl.set("hour", LuaValue.valueOf(d.get(Calendar.HOUR))); + tbl.set("hour", LuaValue.valueOf(d.get(Calendar.HOUR_OF_DAY))); tbl.set("min", LuaValue.valueOf(d.get(Calendar.MINUTE))); tbl.set("sec", LuaValue.valueOf(d.get(Calendar.SECOND))); tbl.set("wday", LuaValue.valueOf(d.get(Calendar.DAY_OF_WEEK)));
Will be fixed in version 3.0.1
Is fixed in version 3.0.1.