# Timer **Repository Path**: olderlong/Timer ## Basic Information - **Project Name**: Timer - **Description**: 基于sched中scheduler的定时器 - **Primary Language**: Python - **License**: LGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 1 - **Created**: 2019-01-28 - **Last Updated**: 2025-01-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Timer ## 介绍 基于sched中scheduler的定时器 ## 软件架构 基于sched 模块实现定时器类 ## 安装教程 ```python python setup.py install ``` ## 使用说明 ```python #!/usr/bin/env python # _*_ coding:utf-8 -*_ from timer import Timer def counter(identity, limit): import sys import datetime for n in range(limit): # stderr无缓存,避免线程间交叉输出 sys.stderr.write('datetime = {}, id = {}, cnt = {}\n'.format(datetime.datetime.now(), identity, n)) def main(): mt = Timer(id=1, max_times=10) mt.start(1, counter, (1, 4)) if __name__ == '__main__': main() ``` ## 码云特技 1. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) 2. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 3. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 4. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 5. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)