Skip to content

Commit 79b6cc7

Browse files
committed
Better millisecond/second detection
1 parent 630dc95 commit 79b6cc7

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

task-1.0.tm

+15-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ proc ::task args {
4343
id { lappend task_id $arg }
4444
ids { lappend task_id {*}$arg }
4545
in { set execution_time [expr { $now + [::task::time $arg] }] }
46-
at { set execution_time $arg }
46+
at {
47+
if { [string length $arg] < [string length $now] } {
48+
# We assume this is seconds since it couldnt be milliseconds :-P
49+
set execution_time [expr { $arg * 1000 }]
50+
} else {
51+
set execution_time $arg
52+
}
53+
}
4754
regex* - glob {
4855
if { [string is false $arg] } {
4956
set flags [lsearch -all -inline -not -exact $flags -all]
@@ -181,7 +188,9 @@ proc ::task::taskman args {
181188
if { $should_execute } {
182189
if { [dict exists $task subst] } {
183190
catch { after 0 [subst -nocommands [dict get $task cmd]] }
184-
} else { after 0 [list try [dict get $task cmd]] }
191+
} else {
192+
after 0 [list try [dict get $task cmd]]
193+
}
185194
}
186195

187196
if { [dict exists $task every] && ! $cancel_every } {
@@ -213,6 +222,10 @@ proc ::task::taskman args {
213222
}
214223
}
215224

225+
proc ::task::execute { cmd } {
226+
227+
}
228+
216229
# removes a task from the scheduled execution context, responds with the
217230
# value requested.
218231
# respond_with can be: total (total tasks removed) | ids (ids of removed tasks)

0 commit comments

Comments
 (0)