多个计时器并行计时,每个计时器支持暂停和继续- (defun $ji-shi$ (biaoshi zt LST / time hs)
- ;zt 如果是0代表是停止计时,同时打印时间到命令行;1时继续计时
- ;调用示例:($ji-shi$ "分析导线" 1 NIL)($ji-shi$ "分析导线" 0 NIL)
- (setq time (vl-bb-ref 'timer))
- (cond
- ((and
- biaoshi
- (assoc biaoshi time)
- zt
- (member zt
- (list '0 '"停止" '"停止计时" '"不再计时" '"stop" '"STOP")
- )
- ) ;停止计时并打印
- (print
- (strcat
- biaoshi
- "耗时: "
- (setq hs (vl-princ-to-string
- (/ (- (getvar "millisecs")
- (cdr (assoc biaoshi time))
- 0.0
- )
- 1000.0
- )
- )
- )
- )
- )
- (setq time (vl-remove (assoc biaoshi time) time))
- )
- ((and biaoshi
- (assoc biaoshi time)
- zt
- (member zt
- (list '1 '"继续" '"持续计时" '"计时" '"继续计时"
- '"START" '"start")
- )
- ) ;继续计时
- () ;其实啥都不需要做
- )
- (t
- (and biaoshi
- (setq time (cons (cons biaoshi (getvar "millisecs")) time))
- )
- )
- )
- (vl-bb-set 'timer nil)
- (vl-bb-set 'timer time)
- (if hs
- hs
- t
- )
- )
|