View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001997 | Spring engine | General | public | 2010-07-23 21:33 | 2010-07-23 23:02 |
| Reporter | SirMaverick | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | no change required | ||
| Product Version | 0.81.2+git | ||||
| Summary | 0001997: os.clock not continuous | ||||
| Description | os.clock() = 2147.3200683594, next second: -2147.4272460938 Overflow? | ||||
| Additional Information | widget output: os.clock error, 2147.3200683594, -2147.4272460938 | ||||
| Tags | No tags attached. | ||||
| Attached Files | |||||
| Checked infolog.txt for Errors | |||||
|
|
static int os_clock(lua_State *L) { lua_pushnumber(L, ((lua_Number)clock()) / (lua_Number)CLOCKS_PER_SEC); return 1; } 1) lua_Number is a float 2) clock() "returns the number of clock ticks elapsed since the program was launched" (in a variable of type clock_t, which on most systems is just an int32 or long32) 3) CLOCKS_PER_SEC is a constant, usually 1000000 Therefore the fact that it overflows after 2147 seconds (2.147 billion ticks) is expected behavior. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2010-07-23 21:33 | SirMaverick | New Issue | |
| 2010-07-23 21:33 | SirMaverick | File Added: test_ostime.lua | |
| 2010-07-23 23:01 | Kloot | Note Added: 0005147 | |
| 2010-07-23 23:01 | Kloot | Note Edited: 0005147 | |
| 2010-07-23 23:02 | Kloot | Status | new => closed |
| 2010-07-23 23:02 | Kloot | Resolution | open => no change required |