CheckTime

Availability All terminals
Description Checks if the time structure passed to the function holds a valid time. For instance, if you specify 61 minutes past 2, the function will return FALSE.
Syntax int CheckTime( struct time *timep );
Arguments
struct time *timep
Pointer to the time structure that is to be checked.
Returns
OK When the time is valid.
ERROR When the time is invalid.
Example
#include <stdio.h>
#include "lib.h"

void main( void )
{
    struct time t;

    t.ti_hour = 12;
    t.ti_min = 12;
    for(;;)
    {
        t.ti_sec = 62;
        printf("\nTime: %02d:%02d:%02d",t.ti_hour,t.ti_min,t.ti_sec);
        if( CheckTime( &t ) == OK )
            printf("\nTime ok!!");
        else
            printf("\nIllegal time!!");
        while( !kbhit() )
            Idle();
        ResetKey();

        t.ti_sec = 12;
        printf("\nTime: %02d:%02d:%02d",t.ti_hour,t.ti_min,t.ti_sec);
        if( CheckTime( &t ) == OK )
            printf("\nTime ok!!");
        else
            printf("\nIllegal time!!");
        while( !kbhit() )
            Idle();
        ResetKey();
    }
}