# calculate elapsed time

This was presented at Devcon 97 by Sue Alchesay.

To calculate elapsed time in Clarion, use both time and date together….. create a real variable, with Clarion standard date on the left side of the decimal point and Clarion standard time on the right side, by dividing it by 8640000. (number of 1/100th of seconds in one day..)

That way, with only one variable, you can do standard calculations and get an age from 1/100th of a second to years, at once, in one single calculation.

Example :

``` program

map
end

Beginning REAL
Ending REAL
ElapsedTime REAL
ElapsedDays LONG
EndDate LONG

CODE
beginning = Today() + (Clock()/8640000)          ! age between now
EndDate = DATE(Month(Today())+1,1,Year(Today())) ! and last day, this month
Ending = EndDate - 1/8640000                     ! at midnight (or first 1/100 of second,next month....)
ElapsedDays = INT(Ending) -INT(beginning)
ElapsedTime = Ending - Beginning
Message('We are ' & ElapsedDays & ' Days, and ' & FORMAT(((ElapsedTime-Elapseddays)*8640000),@t4) & ' Hours before Midnight,next month')
```