I use dclock (with "use ifport") to time my application. It works perfect for a short run, i.e. 300 second. But for a long run, i.e. 1 or 2 days, it gives a negative run time. Could anyone give an explanation for this?
Very interesting. I waded through the source code for DCLOCK (actually, the SECNDS routine it calls internally), and I see that it tries to account for spanning midnight but only over one day. It can't handle a period longer than two days. I recommend the use of the Fortran standard intrinsic SYSTEM_CLOCK instead - it can deal with longer spans.
I will ask the developers to fix DCLOCK as it should not be based on SECNDS. Issue ID is DPD200243198.
Actually, my current solution is to use "gettimeofday" from C. "SYSTEM_CLOCK" seems to be better. I guess I can get a resolution of one microsecond. :D
We've corrected the implementation of DCLOCK for a release later this year. I would caution you that the resolution is dependent on how often the OS updates the elapsed time clock. I think Linux does tend to do it every microsecond, but just because the value you get has a precision of microseconds, that doesn't mean the resolution (gap between increments) is the same.
Thanks, Steve! I always learn something useful from this forum.