I need some tips on an assignment that I am currently working on. I need to create a program for converting time specs (n1y n2n n3d n4h n5m n6s -- note the amount of whitespace can vary between the different inputs) to seconds. One of the functions that I need to create is a function to validate the time spec input (as a const char*). The function header looks as follows:
// is_legal_time_spec:
//      Checks if ctime_spec is a valid time spec
// In:
//      ctime_spec != NULL
// Out:
//      return -- true if the ctime_spec is a valid time spec
//                false if otherwise
bool is_legal_time_spec( const char *ctime_spec ) {
    return false;
}
Ive had some ideas about how to use the strpbrk(3) function for this, but I was wondering if there is another easier function that I can use to check the format of the time spec input.
Thanks in advance for your help.
 
    