CImage:KwdGetHmsEx CImage:KwdGetNum

CImage:KwdGetHMS


The KwdGetHMS method returns a properly formatted string value for an HMS (hours, minutes, and seconds) string in the image header. Use this method to read a keyword not in the standard time format which uses : as the field delimiter. To return a keyword value specified in degrees, minutes, and seconds, use KwdGetDMS.The related KwdGetHmsEx method is preferred, as it returns a status value in addition to the HMS value so that the script can determine whether the target keyword is present in the image.

Syntax

sHMSValue = CImage:KwdGetHMS( sKwd )

Remarks

This method returns a properly formatted time string after reading a keyword value containing hours, minutes, and seconds ("HMS"). The HMS string may contain the following field delimiters:

     space, comma, colon, hyphen, slash, H, h, M, m, S, s, ', "

A preceding minus sign (or hyphen) is handled properly but embedded hyphens are treated as delimiters. The result is formatted into a standard time string of the form hh:mm:ss.sss.

If the specified keyword does not exist, then 0:00:00.000 is returned. To test whether the keyword exists, call KwdExists before this method.

Example

Suppose a CImage named I exists and contains the keyword "RA" which has a value in the incorrect format '12 24 45' (the time fields are supposed to be separated by : characters). The following script returns the value formatted as "12:24:45,000":

sRA = I:KwdGetHMS("RA")

-- read the keyword value

Printf( "Right Ascension= '%s'", sRA )

-- prints Right Ascension = 12:24:45.000

Related Topics

CImage, KwdGetHmsEx, KwdGetDMS, KwdGetStr