# SimpleTime.py **Repository Path**: lemonix/simple-time.py ## Basic Information - **Project Name**: SimpleTime.py - **Description**: 一个简化并加强了time模块的Python模块 - **Primary Language**: Python - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-07-20 - **Last Updated**: 2022-07-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SimpleTime.py *v0.1* ### 介绍 一个简化并加强了time模块的Python模块 目前还很不完善,如有建议,请提在Issues中 ### 教程 #### Runtime > __call__ ```python r = Runtime(point=5) # 实例化一个Runtime(point为保留小数点后多少位,默认值为5) r() # 开始计时 print('This is a time') print(f'waste {r()} second') # 再次调用,返回时间,结束计时 ``` Output: ``` This is a time waste 0.00000 second ``` > dec_runtime ```python @r.dec_runtime def test(): time.sleep(1) return True print(test()) ``` Output: ``` (True, ' 1.00066') ``` #### Timer > sleep **同time.sleep** #### FmtTime ```python full_time = time.localtime() self.second = full_time.tm_sec self.month = full_time.tm_mon self.month_day = full_time.tm_mday self.hour = full_time.tm_hour self.minute = full_time.tm_min self.week_day = full_time.tm_wday self.year_day = full_time.tm_yday self.full_time = datetime.now() ```