Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 5 - Text Utilities / Text Utilities Reference
Routines / Converting Date and Time Strings Into Numeric Representations


StringToTime

The StringToTime function parses a string for a time specification and converts the date information into values in a date-time record. At the beginning of the string, it expects a time specification in a format defined by the current script. It returns a status value that indicates the confidence level for the success of the conversion.

FUNCTION StringToTime(textPtr: Ptr; textLen: LongInt;
                  theCache: DateCachePtr; VAR lengthUsed: LongInt; 
                  VAR dateTime: LongDateRec): StringToDateStatus;
textPtr
A pointer to the text string to be parsed.
textLen
The number of bytes in the text string.
theCache
A pointer to the date cache record initialized by the InitDateCache function with data that is used during the conversion process.
lengthUsed
On output, contains the number of bytes of the string that were parsed for the time.
dateTime
On output, this LongDateRec record contains the hour, minute, and second values that were parsed for the time.
DESCRIPTION
StringToTime parses the string until it has finished finding all time information or until it has examined the number of bytes specified by textLen. It returns a status value that indicates the confidence level for the success of the conversion.

Note that StringToTime fills in only the hour, minute, and second; StringToDate fills in the year, month, day, and day of the week. You can use these two routines sequentially to fill in all of the values in a LongDateRec record.

StringToTime assigns to its lengthUsed parameter the number of bytes that it used to parse the date.

StringToTime returns the same status value indicator type as does StringToDate: a set of bit values that indicate confidence levels, with higher numbers indicating low confidence in how closely the input string matched what the routine expected. The possible values of this type are described in Table 5-5 on page 5-33.

SPECIAL CONSIDERATIONS
StringToTime may move memory; your application should not call this function at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the StringToTime function are
Trap macroSelector
_ScriptUtil$8214 FFF4


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996