Software / code / prosody
Comparison
util/timer.lua @ 5878:2b1c0c0a2ea6
util.timer: Fix variable name typo.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Wed, 30 Oct 2013 17:51:37 -0400 |
| parent | 5877:615a0774e4cc |
| child | 5879:95f1d5421fbc |
comparison
equal
deleted
inserted
replaced
| 5877:615a0774e4cc | 5878:2b1c0c0a2ea6 |
|---|---|
| 115 | 115 |
| 116 local id = h:insert(callback, event_time); | 116 local id = h:insert(callback, event_time); |
| 117 params[id] = param; | 117 params[id] = param; |
| 118 if next_time == nil or event_time < next_time then | 118 if next_time == nil or event_time < next_time then |
| 119 next_time = event_time; | 119 next_time = event_time; |
| 120 _add_task(next_time - current_time, on_timer); | 120 _add_task(next_time - current_time, _on_timer); |
| 121 end | 121 end |
| 122 return id; | 122 return id; |
| 123 end | 123 end |
| 124 function stop(id) | 124 function stop(id) |
| 125 params[id] = nil; | 125 params[id] = nil; |
| 129 local current_time = get_time(); | 129 local current_time = get_time(); |
| 130 local event_time = current_time + delay; | 130 local event_time = current_time + delay; |
| 131 h:reprioritize(id, delay); | 131 h:reprioritize(id, delay); |
| 132 if next_time == nil or event_time < next_time then | 132 if next_time == nil or event_time < next_time then |
| 133 next_time = event_time; | 133 next_time = event_time; |
| 134 _add_task(next_time - current_time, on_timer); | 134 _add_task(next_time - current_time, _on_timer); |
| 135 end | 135 end |
| 136 return id; | 136 return id; |
| 137 end | 137 end |
| 138 | 138 |
| 139 return _M; | 139 return _M; |