This function checks if the time structure passed to the function holds a valid time.

Syntax

short CheckTime(
  struct time_struct *timep
);

Parameters

timep
[in] Pointer to the time_struct structure that is to be checked.

Return value

Returns OK if the time is valid, ERROR otherwise.

Remarks

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 ERROR.

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"

void main( void )
{
    struct time_struct t;

    t.ti_hour = 12;
    t.ti_min = 12;
    for(;;)
    {
        t.ti_sec = 62;
        if( CheckTime( &t ) == OK )
            printf("\fTime ok!!\n");
        else
            printf("\fIllegal time!!");
        while( !kbhit() )
            Idle();
        ResetKey();

        t.ti_sec = 12;
        if( CheckTime( &t ) == OK )
            printf("\fTime ok!!\n");
        else
            printf("\fIllegal time!!");
        while( !kbhit() )
            Idle();
        ResetKey();
    }
}

Last updated: 2020/10/07