请教LISP有计时器功能的函数吗?
如题THANKS <P>ACAD中系统变量中关于时间的有:</P><P>系统变量名 说明<BR>CDATE 当前机器的日历, 日期时间<BR>DATE 日子数(Julian)阳历<BR>TDCREATE 图形建立的日期和时间<BR>TDINDWG 图形编辑时间<BR>TDUPDATE 最近一次更新的日期和时间<BR>TDUSRTIMER 本次使用时间<BR>楼主可以在程序中用GETVAR函数读取数值进行处理。</P> 看一下帮助里面的 menucmd函数吧 ;;; ==================================================================
;;; 计时开始,与th-runtime配合使用,计算程序运行时间.
;;; ==================================================================
(defun th-starttime ()
(setq start-time (* 86400 (getvar "tdusrtimer")))
)
;;; ==================================================================
;;; 计时统束,与th-starttime配合使用,计算程序运行时间.
;;; ==================================================================
(defun th-runtime (/ d end-time h m s ts)
(if start-time
(progn
(setq end-time (* 86400 (getvar "tdusrtimer"))
ts (- end-time start-time)
d (rtos (fix (/ ts 86400.0)) 2 0)
ts (rem ts 86400)
h (rtos (fix (/ ts 3600.0)) 2 0)
ts (rem ts 3600)
m (rtos (fix (/ ts 60.0)) 2 0)
ts (rem ts 60)
s (rtos ts 2 2)
)
(if (> (distof d) 0)
(princ (strcat "\n用时 : " d "天" h "小时" m "分" s "秒"))
(if (> (distof h) 0)
(princ (strcat "\n用时 : " h "小时" m "分" s "秒"))
(if (> (distof m) 0)
(princ (strcat "\n用时 : " m "分" s "秒"))
(princ (strcat "\n用时 : " s "秒"))
)
)
)
)
)
(princ)
) 用mnucmd写更简单 帮助中 mnucmd:引用下拉菜单或快捷菜单
和时间有什么关系啊?
页:
[1]