---
title: kupl_get_wtime
description: "获取当前时间（秒）。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/KunpengHPCKit_developer_243.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/KunpengHPCKit_developer_243.html
indexId: bb1c74cf1ee9460e3a41ceb6ff9e2c987b947a1c5f3b5a89beba1854deba41e967
---
# kupl_get_wtime

获取当前时间（秒）。

#### 接口定义

int kupl_get_wtime();


#### 返回值

- 返回当前的时间（秒）


#### 示例

```
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include "kupl.h"

int main()
{
    double start = kupl_get_wtime();
    usleep(1000001);
    double end = kupl_get_wtime();
    assert(end - start >= 1);
    return 0;
}
```


- 上述示例演示了获取当前时间（秒）的流程。
- 上述kupl_get_wtime函数获取当前的时间，通过两次调用该函数的返回值的差值得到时间间隔。
