VWED_server/docs/sc/系统线程相关.md

84 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

```markdown
## 多线程及时间
#### 休眠指定时间
* 方法说明
本方法是异步方法,使当前协程休眠指定时间,不会阻塞整个系统。
```python
async def sleep(ms: int) -> None
```
* 输入参数
* msint 类型,休眠的时间,单位毫秒。
* 输出参数
本方法输出参数为空。
* 异常
本方法不抛出异常。
* 使用示例
```python
# 异步休眠1秒
await VWED.system_thread.sleep(1000)
```
#### 获取当前系统时间戳
* 方法说明
获取当前的系统时间戳。
```python
def current_time_millis() -> int
```
* 输入参数
* 输出参数
int 类型,当前系统的毫秒时间戳。
#### 获取当前时间
* 方法说明
获取当前系统的格式化时间。
```python
def now_date() -> str
```
* 输入参数
* 输出参数
字符串:按照 `yyyy-MM-dd HH:mm:ss` 格式。
* 异常
本方法不抛出异常。
#### 将时间戳转为日期格式
* 方法说明
将时间戳转为格式化的日期时间。
```python
def time_millis_format(time: int) -> str
```
* 输入参数
* timeint 类型,当前毫秒时间戳。
* 输出参数
字符串:按照 `yyyy-MM-dd HH:mm:ss` 格式。
* 异常
本方法会抛出异常。
```