function neci_etime(time) result(ret)
! Return elapsed time for timing and calculation ending purposes.
real(dp), intent(out) :: time(2)
real(dp) :: ret
#if defined(IFORT_) || defined(INTELLLVM_)
! intels etime takes a real(4)
real(sp) :: ioTime(2)
! Ifort defines etime directly in its compatibility modules.
! Avoid timing inaccuracies from using cpu_time on cerebro.
ret = real(etime(ioTime), dp)
time = real(ioTime, dp)
#else
#ifdef BLUEGENE_HACKS
time = 0.0_dp
ret = 0.0_dp
#else
! use MPI_WTIME - etime returns wall-clock time on multi-processor
! environments, so keep it consistent
ret = MPI_WTIME()
time(1) = ret
time(2) = 0._dp
#endif
#endif
end function neci_etime