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