Page 1 of 1

Total Elapsed Time

Posted: December 26th, 2021, 8:50 am
by Nikola
How can I indicate the total time elapsed during the session in question?
I want to make a format like HH:MM (e.g. hours:minutes).

I tried using Timestamp Function.

1. PROC START_TIME
Preproc
$ = timestamp();

2. PROC END_TIME
Preproc
$ = timestamp();

3. PROC DURATIOIN
Prerpoc
$ = END_TIME - START_TIME;

However, it only shows in seconds (e.g. 70 minutes)

In addition, I tried to use TimeString Function. However, I didn't understand (especially the TimeString format) and how to apply it.

Thank you in advance.

Re: Total Elapsed Time

Posted: December 27th, 2021, 8:46 am
by Gregory Martin
The timestring function is for formatting dates and or/times. It can't be used for formatting a duration. In your case, you can use some math to get the values you want:
numeric elapsed_seconds = END_TIME - START_TIME;

numeric hours = int(elapsed_seconds / 60 / 60);
numeric minutes = int(elapsed_seconds / 60) % 60;

errmsg("Duration is %02d:%02d", hours, minutes);