/* $DOC$ $NAME$ WaitPeriod() $CATEGORY$ hbct date and time functions $ONELINER$ Pauses a specified time in increments of 1/100 seconds $SYNTAX$ WaitPeriod( [] ) --> lNotElapsed $ARGUMENTS$ Designates the waiting period at initialization in 1/100ths of seconds. Values from 1 to 8, 640, 000 (one day) are possible. $RETURNS$ WaitPeriod() returns .T., if the time span designated at initialization has not elapsed. $DESCRIPTION$ This function sets a time span for a DO WHILE loop to run. The function must initialize prior to the loop, since you must specify the parameter in 1/100th seconds. Subsequently, the function can be implemented without a parameter for additional loop conditions. It returns .T., as long as the designated time span has not yet run out. Note The function notes the status of the internal timer at initialization. From that point on, the initialization should always precede the respective DO WHILE; otherwise, the time delay is incorrect. The passing of midnight (the time resets to the 0 value) is taken into account. $EXAMPLES$ // Run a loop for 5 seconds: WaitPeriod( 500 ) // Initialization, 5 seconds DO WHILE .AND. .AND. WaitPeriod() // ... ENDDO $STATUS$ Ready $COMPLIANCE$ WaitPeriod() is Clipper Tools compatible. $PLATFORMS$ All $FILES$ Library is hbct. $SEEALSO$ $END$ */ /* $DOC$ $NAME$ TimeValid() $CATEGORY$ hbct Date and Time Functions $ONELINER$ Determines whether a specIFied time is valid $SYNTAX$ TimeValid( ) --> lValid $ARGUMENTS$ Designates a character string that contains the time to test. $RETURNS$ TimeValid() RETURNs .T. when is a valid time; or .F. when is an invalid time. $DESCRIPTION$ With input that requires time manipulation, writing your own UDF to check time inputs was unavoidable up to now. TimeValid() permits Complete checking of a time designation. You can use this FUNCTION effectively with a VALID clause within a READ mask. Note Note the format for time designations. There must always be two digits for hours, minutes, seconds, and hundredths; otherwise, the time it is regarded as invalid. Valid examples are "12", "12:59", "12:59:59", and "12:59:59:99". By contrast, invalid examples are "24", "12:60", or "12:1", and/or "12:". IF you work with time strings that are not completely filled and that you need to check with TimeValid(), then they must be TRIMmed prior to the use of TimeValid() (see following Examples). $EXAMPLES$ // Using the VALID clause with TRIM, all valid times are // accepted, even IF no seconds or minutes are specIFied: cBegin := Space( 11 ) @ 5, 10 SAY "Please input time for beginning work:"; GET cBegin VALID TimeValid( RTrim( cBegin ) ) READ // Using a VALID clause without TRIM, hours and minutes must be // specified, so that TimeValid() can confirm a valid time: cBegin := Space( 5 ) @ 5, 10 SAY "Please input time for beginning work:"; GET cBegin VALID TimeValid( cBegin ) READ $STATUS$ Ready $COMPLIANCE$ This function is CA-Cl*pper Tools compatible. $PLATFORMS$ All $FILES$ Library is hbct. $SEEALSO$ SetTime() $END$ */ /* $DOC$ $NAME$ SetTime() $CATEGORY$ hbct Date and Time Functions $ONELINER$ Sets the system clock $SYNTAX$ SetTime( , [] ) --> lSet $ARGUMENTS$ Designates a character string that contains the time that is to become the system time. Designates whether the time should also be set in the CMOS-RAM of an AT. The default is do not write to CMOS-RAM. Note that in Windows platform this adjust is automatic, therefore this parameter is without effect. $RETURNS$ The FUNCTION RETURNs .T. when the time is set successfully. $DESCRIPTION$ When you use this FUNCTION to convert the time into the system time from within your application, all files acquire this time with each write procedure. $EXAMPLES$ // Set the system time in each case; but the hardware clock only // on an AT: cNewTime := "10:20:00" IF IsAt() SetTime( cNewTime, .T. ) ELSE SetTime( cNewTime ) ENDIF Or, more compactly: SetTime( cNewTime, IsAt() ) $STATUS$ Ready $COMPLIANCE$ This function is CA-Cl*pper Tools compatible. $PLATFORMS$ Windows, Linux $FILES$ Library is hbct. $SEEALSO$ SetDate(), TimeValid() $END$ */ /* $DOC$ $NAME$ SetDate() $CATEGORY$ hbct Date and Time Functions $ONELINER$ Sets the system date $SYNTAX$ SetDate( , [] ) --> lSet $ARGUMENTS$ Designates which date to use to set the system date. Designates whether the date should also be set in the CMOS- RAM of an AT. The default is do not write (.F.). Note that in Windows platform this adjust is automatic, therefore this parameter is without effect. $RETURNS$ SetDate() RETURNs .T. when the date is successfully set. $DESCRIPTION$ When you use this FUNCTION to set the system date from within your application, all files acquire this date with each write procedure. $EXAMPLES$ // Set the system date in each case; but the hardware clock only // on an AT: dNewDate := hb_SToD( "19910730" ) IF IsAt() SetDate( dNewDate, .T. ) ELSE SetDate( dNewDate ) ENDIF Or, more compactly: SetDate( dNewDate, IsAt() ) $STATUS$ Ready $COMPLIANCE$ This function is CA-Cl*pper Tools compatible. $PLATFORMS$ Windows, Linux $FILES$ Library is hbct. $SEEALSO$ SetTime() $END$ */