---
title: 不推荐使用etime函数
description: "DTIME或者ETIME函数非标准Fortran函数，他们是通过固有函数CPU_TIME和SYSTEM_CLOCK构造而成。目前flang不保证其结果正确性，不推荐使用。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdevps/compilation/ug-bisheng/kunpengbisheng_06_0062.html
sourcePath: /source/zh/kunpengdevps/compilation/ug-bisheng/kunpengbisheng_06_0062.html
indexId: 8360a547ad23945026d4cef198ab590cd76240fb16aac49d1ac3eb462b8e44f874
---
# 不推荐使用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
```
