User Tools

Site Tools

Navigation:  Language Reference > 14 - Dates, Time and Keycodes >====== Standard Time ====== Previous pageReturn to chapter overviewNext page

A Clarion standard time is the number of hundredths of a second that have elapsed since midnight, plus one (1). The valid range is from 1 (defined as midnight) to 8,640,000 (defined as 11:59:59.99 PM). A standard time of one is exactly equal to midnight to allow a zero value to be used to detect no time entered. Although time is expressed to the nearest hundredth of a second, the system clock is only updated 18.2 times a second (approximately every 5.5 hundredths of a second).

The LONG data type with a time format (@T) display picture is normally used for a standard time. The TIME data type is a data format used in the Btrieve Record Manager. A TIME field is internally converted to LONG containing the Clarion standard time before any mathematical or time procedure operation is performed. Therefore, TIME should be used for external Btrieve file compatibility, and LONG should normally be used for other times.

When you work with TIME and LONG data types (to represent a Standard Clarion Time) the  RTL will automatically convert to or from a Clarion Standard Time.  A Standard Time of 0 (zero) indicates NoTime in Clarion (i.e. the field is empty), but there is no equivalent with the TIME data type.  When converting a TIME data type back to a LONG the RTL must choose to either convert TIME 0 to NoTime or to Midnight.  The default behavior of Clarion is to convert TIME 0 to Standard Time 0 (NoTime). You can force Clarion to convert TIME 0 to Standard Time 1 by setting the SYSTEM property PROP:TimeZeroIsLongOne to TRUE.

For SQL backends, in Clarion the SQL DateTime data type is typically represented as a

GROUP with both a date and time field.

You can specify the behavior of the RTL using these PRAGMA settings:

PRAGMA ('define(sqltime0⇒off)')

PRAGMA ('define(sqltime0⇒on)')

Examples and defined behavior:

PRAGMA ('define(sqltime0⇒off)')

This is the default value and does not need to be set. The compiler does nothing for fields of SQL tables having the TIME type.

PRAGMA ('define(sqltime0⇒on)')

If the TIME value to convert is a field of a FILE structure, the compiler generates

a call to the NULL function. If the result from the NULL() function is TRUE (the field has

a NULL value), the TIME field is converted to 0 (TIME:NOTIME) value.

It is easiest to set the PRAGMA to the desired value at the Project level (Project Properties) But PRAGMA directives can be set before any line in your code where TIME value is being used in an expression converting TIME to LONG.

Note: If a variable/field of the TIME data type is set as the USE variable of some control, TIME(0) is always converted to LONG(1). See Also:**

Time Pictures



standard_time.htm.txt · Last modified: 2021/04/15 15:57 by