#include "geninc.h"  /* DBGET(), TIMCMP() */

/**************** check_time ***********************************
   gets time of current profile ("now") from the database,
   returns 1 if the time is between
   start and end times, 0 otherwise.

   prototype in: use_db.h
*/
#if PROTOTYPE_ALLOWED
int check_time(YMDHMS_TIME_TYPE *now, YMDHMS_TIME_TYPE *start, YMDHMS_TIME_TYPE *end)
#else
int check_time(now, start, end)
   YMDHMS_TIME_TYPE *now,               /* output */
                    *start, *end;       /* input */
#endif
{
   int type = TIME,
       ierr;
   unsigned int n = sizeof(YMDHMS_TIME_TYPE);

   DBGET(&type, (char *) now, &n, &ierr);
   if (DBERROR(&ierr, "in check_time")) return(0);
   if (TIMCMP(now, start)==1 || TIMCMP(now, end)==2) return 0;
   else return 1;
}                       /* check_time */
