9 const char *text_start = text;
13 while ( isspace( *text ) )
32 }
else if( ch==
'm' || ch==
'M' ) {
40 if( isalpha( *text ) )
45 while ( isspace( *text ) )
48 *pLength = text - text_start;
54 int fb_hTimeParse(
const char *text,
size_t text_len,
int *pHour,
int *pMinute,
int *pSecond,
size_t *pLength )
57 const char *text_start = text;
60 int hour = 0, minute = 0, second = 0;
63 hour = strtol( text, &endptr, 10 );
64 if( hour >= 0 && hour < 24 && endptr!=text) {
65 int is_ampm_hour = ( hour >= 1 && hour <= 12 );
68 while ( isspace( *text ) )
72 minute = strtol( text, &endptr, 10 );
73 if( minute >= 0 && minute < 60 && endptr!=text ) {
75 while ( isspace( *text ) )
81 second = strtol( text, &endptr, 10 );
83 if( second < 0 || second > 59 ) {
92 if( result && is_ampm_hour ) {
99 }
else if( is_ampm_hour ) {
119 length = text - text_start;