---
title: 不推荐使用etime函数
description: "DTIME或者ETIME函数非标准Fortran函数，他们是通过固有函数CPU_TIME和SYSTEM_CLOCK构造而成。目前flang不保证其结果正确性，不推荐使用。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdevkithistory/bisheng/hist-bisheng/kunpengbisheng_06_0062_1.html
sourcePath: /source/zh/kunpengdevkithistory/bisheng/hist-bisheng/kunpengbisheng_06_0062_1.html
indexId: 9e7d37bc1cd4cb4d8412b9fff2a3140298624d57b89058ddf6f27ea9082d6e4782
---
# 不推荐使用etime函数

#### 问题介绍

DTIME或者ETIME函数非标准Fortran函数，他们是通过固有函数CPU_TIME和SYSTEM_CLOCK构造而成。目前flang不保证其结果正确性，不推荐使用。


#### 解决方案

参考网上用例手写DTIME或者ETIME函数：

```
! ETIME in standard Fortran. 
Real Function etime(time) 
    Real time(2) 
    Call Cpu_Time(etime) 
    time(1) = etime 
    time(2) = 0 
End Function
```
