1 Star 0 Fork 0

hxz / soft-universal-time

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

soft-universal-time

Get universal time (in MILLISECONDS) from a variable which is periodically updated by a background thread.

This is used for very intensively time getting with not very high accuracy.

The usage is very simple:

  1. set-soft-time-resolution, defines the updating resolution, which is default by 0.005 second.
  2. initialize-soft-time, run the background thread to update the time.
  3. Call *time-getter* to get the result, in milliseconds. Here, *time-getter* is an function object, which is set to the real soft time getter or hard time getter, according to the time policy.

If you only want to get the OS time, just call get-hard-time without the steps above.

get-universal-time runs as fast as get-soft-time, however, get-universal-time returns time by seconds, while get-soft-time returns time by milliseconds.

API

;; simple usage
(set-soft-time-resolution 0.01)
(initialize-soft-time)
(funcall *time-getter*) ; get universal time in milliseconds

;; get an set time policy, can be either :soft or :hard, default :soft
(get-time-policy)
(set-time-policy :hard)

;; time resolution, in seconds, should be greater than 0
(get-soft-time-resolution)
(set-soft-time-resolution 0.1)

(shutdown-soft-time)
(restart-soft-time)
(soft-time-enabled-p) ; if updating thread started

;; get time directly
(get-soft-time)
(get-hard-time)

空文件

简介

Get universal time (in MILLISECONDS) from a variable which is periodically updated by a background thread. This is used for very intensively time getting with not very high accuracy. 展开 收起
Common Lisp
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/hxz/soft-universal-time.git
git@gitee.com:hxz/soft-universal-time.git
hxz
soft-universal-time
soft-universal-time
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891