Tag Archive: time

time since last reboot

Try GetTickCount: – You can use this to tell how long the computer has been running – From there you can calculate when the last reboot happened.

http://msdn.microsoft.com/library/en-us/sysinfo/base/gettickcount.asp

GetTickCount(),Long,PASCAL,proc,NAME('GetTickCount'),Dll(dll_mode)

local               group, pre(loc)
UpTime                long
UpDays                long
UpHours               long
UpMins                long
                    end


    loc:UpTime = GetTickCount()
    loc:UpDays = (((loc:UpTime / 1000) / 60) / 60) / 24
    loc:UpHours = (((loc:UpTime / 1000) / 60) / 60) % 24
    loc:UpMins = (((loc:UpTime / 1000) / 60) % 60)

Can display something like this:

 ' Up_Time = ' & loc:UpDays & 'd ' & loc:UpHours & 'h ' & format(loc:UpMins, @N02) & 'm'

Cheers
Jono Woodhouse

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')