TutTimeCvtStrToNum


Name

TutTimeCvtStrToNum — convert a string time value to a number

Synopsis

T_BOOL TutTimeCvtStrToNum(time_cvtr, time_str, time_num_return) 
T_TIME_CVT time_cvtr; 
T_STR time_str; 
T_REAL8 *time_num_return; 

Arguments

time_cvtr — time converter to use

time_str — string time value to be converted to a number

time_num_return — pointer to store converted time number into

Return Values

TRUE if time_str successfully converted, FALSE otherwise.

Diagnostics

None

Description

TutTimeCvtStrToNum calls the convert function of a time converter to convert a time string to a number. It is normally never necessary to use TutTimeCvtStrToNum directly; use the convenience function TutTimeStrToNum instead.

Unlike TutTimeCvtNumToStr, which rarely fails (returns FALSE), it is more likely that TutTimeCvtStrToNum can fail, since it has the more difficult job of converting a time string to a number. If time_str is in a format that time_cvtr is not prepared to handle (such as the string "last week"), then time_cvtr’s string to number function fails and returns FALSE.

Caution

If  TutTimeCvtStrToNum returns FALSE, it does not put anything in time_num_return.

See Also

TutTimeCvtLookup, TutTimeCvtNumToStr, TutTimeStrToNum

Examples

This example looks up the time converter hms and uses it to convert the string 13:56:58 to a time number:

T_TIME_CVT time_cvtr; 
T_STR time_str = "13:56:58"; 
T_REAL8 time_num; 
 
time_cvtr = TutTimeCvtLookup("hms"); 
if (time_cvtr != NULL) { 
  if (TutTimeCvtStrToNum(time_cvtr, time_str, &time_num)) { 
    TutOut("Time: string %s, number %f\n", time_str, time_num); 
  }  
}  

TIBCO SmartSockets™ Utilities
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com