` Time calculations with midnight rollover (Bernard Grosperrin ) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Par2: Time calculations with midnight rollover
1998-02-08 -- Bernard Grosperrin
 
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')


Today is April 23, 2024, 10:33 am
This article has been viewed 35125 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: