(L *LState)
| 192 | } |
| 193 | |
| 194 | func osTime(L *LState) int { |
| 195 | if L.GetTop() == 0 { |
| 196 | L.Push(LNumber(time.Now().Unix())) |
| 197 | } else { |
| 198 | lv := L.CheckAny(1) |
| 199 | if lv == LNil { |
| 200 | L.Push(LNumber(time.Now().Unix())) |
| 201 | } else { |
| 202 | tbl, ok := lv.(*LTable) |
| 203 | if !ok { |
| 204 | L.TypeError(1, LTTable) |
| 205 | } |
| 206 | sec := getIntField(L, tbl, "sec", 0) |
| 207 | min := getIntField(L, tbl, "min", 0) |
| 208 | hour := getIntField(L, tbl, "hour", 12) |
| 209 | day := getIntField(L, tbl, "day", -1) |
| 210 | month := getIntField(L, tbl, "month", -1) |
| 211 | year := getIntField(L, tbl, "year", -1) |
| 212 | isdst := getBoolField(L, tbl, "isdst", false) |
| 213 | t := time.Date(year, time.Month(month), day, hour, min, sec, 0, time.Local) |
| 214 | // TODO dst |
| 215 | if false { |
| 216 | print(isdst) |
| 217 | } |
| 218 | L.Push(LNumber(t.Unix())) |
| 219 | } |
| 220 | } |
| 221 | return 1 |
| 222 | } |
| 223 | |
| 224 | func osTmpname(L *LState) int { |
| 225 | file, err := os.CreateTemp("", "") |
nothing calls this directly
no test coverage detected
searching dependent graphs…