---
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_0.html
sourcePath: /source/zh/kunpengdevkithistory/bisheng/hist-bisheng/kunpengbisheng_06_0062_0.html
indexId: f2302376f09b8be71e544642f5bc9ff31931edc03027a47f8e086bff3c8600b582
---
# 不推荐使用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
```
