The Clarion Challenge - Calculating Times
Posted March 8 1999
So you think you can write some tight Clarion code?
Try your hand at this problem. The challenge is to come up with either the smallest or the fastest Clarion code to meet the following requirement:
The Requirement
A recent Clarion Advisor column discussed how to calculate time values. One place this is necessary is in tracking billable time. Write some Clarion code to determine the number of blocks of time in a specified period.
Assume you have two LONG fields, one containing a start time, the other containing an end time. You also have a SHORT field containing a value of from 1 to 60 minutes, and a byte flag indicating if times are to be rounded.
For example, assume that time is billed in 15 minute increments. The time period started at 3:00 p.m. and ended at 3:50 p.m. If the rounding flag is set, the result would be three billable units, since 5 minutes rounds down to zero minutes. If the time period ended at 3:55 p.m., the result would be four billable units since 10 minutes rounds up to 15 minutes. If the rounding flag is off, then both times result in four billable periods, since any partial period is billed as a whole period.
Remember that the second time may be past midnight. You do not need to consider the possibility of it being more than one day past midnight.
The most compact and the fastest examples will be posted here, along with any others deemed of special interest.
Article comments
Search ClarionMag
From the archives
C7 Builds 5646 and 5675 Released
6/9/2009 12:00:00 AM
SoftVelocity has released Clarion 7 builds 5646 and 5675. Dave Harms reports.
