/*************************************************
 **                                             **
 **   sc_clock.h                                **
 **                                             **
 **     SoftC Clock/Calendar functions header   **
 **                                             **
 **          Copyright (C) 1989, 1990 by        **
 **               SoftC, Ltd.                   **
 **               16820 3rd St NE               **
 **               Ham Lake, MN 55304            **
 **               (612) 434-6968                **
 **                                             **
 **             All rights reserved.            **
 *************************************************/



/**********
 *
 *  Defines
 *
 **********/




#define SC_GREGOR 1         /* Gregorian date "mm/dd/yy" */
#define SC_GREGORL 2        /* Gregorian date "mm/dd/yyyy" */
#define SC_JULIAN 3         /* Julian date "yyyy/ddd" */
#define SC_YMD 4            /* dBASE date "yyyymmdd" */
#define SC_DMY 5            /* European Military date "ddmmyy" */

#define SC_CSHMS 1          /* colon separated time "hh:mm:ss" */
#define SC_MIL 2            /* Military time 0000 - 2359 */



/**********
 *
 *  Integer Date Source Function Prototypes
 *
 **********/




int sccdi2l(    long *,           /* number of days since 1/1 0001 */
                int,              /* year */
                int,              /* month */
                int );            /* day */

int sccdi2s(    char *,           /* date string */
                int,              /* date string format (YMD, GREG, JUL) */
                int,              /* year */
                int,              /* month */
                int );            /* day */

int sccdiget(   int *,            /* current DOS year */
                int *,            /*             month */
                int *,            /*             day of month */
                int *);           /*             day of week */

int sccdileap(  int );            /* year */

int sccdiperm(  char *,           /* number of days in month */
                int,              /* desired year */
                int);             /* desired month */




/**********
 *
 *  Long Date Source Function Prototypes
 *
 **********/




int sccdl2dow(  char *,           /* day number (0-6) */
                long );           /* long date source */

int sccdl2i(    int *,            /* year */
                int *,            /* month */
                int *,            /* day */
                long );           /* long date source */

int sccdl2sx(   char *,           /* date string */
                int,              /* date string format */
                long);            /* number of days since 1/1/00 */




/**********
 *
 *  String Date Source Function Prototypes
 *
 **********/



int sccds2day(  char *,           /* day of week string */
                char *,           /* source date string */
                int );            /* source date string format */

int sccds2dow(  char *,           /* day of week number */
                char *,           /* source date string */
                int );            /* source date string format */

int sccds2i(    int *,            /* year */
                int *,            /* month */
                int *,            /* day */
                char *,           /* date string */
                int );            /* string format */

int sccds2lx(   long *,           /* number of days since 1/1 0001 */
                char *,           /* date string */
                int );            /* date string format (YMD,GREG, JUL) */

int sccds2mon(  char *,           /* month of year string */
                char *,           /* source date string */
                int );            /* source date string format */

int sccds2s(    char *,           /* output date string */
                int,              /* output string format */
                char *,           /* source date string */
                int );            /* source string format */

int sccdsday(   char *,           /* day of week text string */
                char);            /* numeric day of week */

int sccdsdiff(  long *,           /* difference in days */
                char *,           /* date string */
                int,              /* string format (YMD, GREG, JULIAN) */
                char *,           /* date string */
                int);             /* string format (YMD, GREG, JULIAN) */

int sccdsget(   char *,           /* DOS date string */
                int );            /* date string format */

int sccdsleap(  char *,           /* date string */
                int );            /* string format (YMD,GREG,JULIAN) */

int sccdsmonth( char *,           /* month text string */
                char);            /* numeric month */

int sccdsperm(  char *,           /* number of days in month */
                char *,           /* date string */
                int );            /* string format (YMD, GREG, JUL) */

int sccdsvalid( char *,           /* date string */
                int );            /* string format (YMD,GREG,JULIAN) */





/**********
 *
 *  Integer Clock Source Function Prototypes
 *
 **********/




int sccti2s(    char *,           /* time string */
                int,              /* string format (H:M:S) */
                int,              /* hours */
                int,              /* minutes */
                int);             /* seconds */

int scctiget(   int *,            /* current DOS hour */
                int *,            /*             minute */
                int *,            /*             second */
                int * );          /*             hundredths of second */






/**********
 *
 *  String Clock Source Function Prototypes
 *
 **********/




int sccts2i(    int *,            /* hours */
                int *,            /* minutes */
                int *,            /* seconds */
                char *,           /* time string */
                int);             /* string format (H:M:S) */

int scctsdiff(  long *,           /* number of seconds difference */
                char *,           /* time 1 */
                int,              /* string format */
                char *,           /* time 2 */
                int);             /* string format (H:M:S) */

int scctsget(   char *,           /* current time in string format */
                int);             /* time string format (MIL, H:M:S) */

int scctsvalid( char *,           /* time string */
                int);             /* string format (H:M:S) */




/**********
 *
 *  External Variables
 *
 **********/




extern char sc_dpm[13];    /* days per month array */



/**********
 *
 *  Compatibility Definitions
 *
 **********/




#define sccday(a,b) sccdsday(a,b)
#define sccddiff(a,b,c) sccdsdiff(a,b,SC_YMD,c,SC_YMD)
#define sccdl2s(a,b) sccdl2sx(a,SC_YMD,b)
#define sccdn2s(a,b,c,d) sccdi2s(a,SC_YMD,b,c,d)
#define sccdperm(a,b) sccdsperm(a,b,SC_YMD)
#define sccdpermi(a,b,c) sccdiperm(a,b,c)
#define sccds2l(a,b) sccds2lx(a,b,SC_YMD)
#define sccds2n(a,b,c,d) sccds2i(a,b,c,d,SC_YMD)
#define sccdvalid(a) sccdsvalid(a,SC_YMD)
#define sccleap(a) sccdsleap(a,SC_YMD)
#define sccleapi(a) sccdileap(a)
#define sccmonth(a,b) sccdsmonth(a,b)

#define scctdiff(a,b,c) scctsdiff(a,b,SC_CSHMS,c,SC_CSHMS)
#define scctn2s(a,b,c,d) sccti2s(a,SC_CSHMS,b,c,d)
#define sccts2n(a,b,c,d) sccts2i(a,b,c,d,SC_CSHMS)
#define scctvalid(a) scctsvalid(a,SC_CSHMS)

