home *** CD-ROM | disk | FTP | other *** search
- /*********************
- *
- * ut_test2.c - utilities test program.
- *
- * Purpose: This file contains tests of the utility functions.
- * See also ut_test1.c
- *
- * Blackstar C Function Library
- * (c) Copyright 1985 Sterling Castle Software
- *
- *******/
-
- #include <stdio.h>
- #include <stdlib.h>
- #include "blackstr.h"
- #include "ut_head.h"
- #include "co_head.h"
-
- void main()
- {
- int i;
- char timestr[64],datestr[128];
- struct DATE adate;
- extern int hour_,minute_,sec_,hsec_;
- extern char timeoptf_,dateoptf_;
- long ldate,ltime;
- char *ptr;
- extern char *ut_todaystr();
-
- co_init(0);
- co_mode(BW80,FWHITE,BBLACK);
- co_clr(); /* clear screen */
-
- kb_init(NULL,NULL,NULL);
- printf("Hello from utilities test 2");
-
- printf("\n\n\rPhase 1 - Pause for 2 secs");
- ut_gtime();
- printf("\n\rTime at start is %02d:%02d:%02d.%02d", hour_,minute_,sec_,hsec_);
- ut_pause(200);
- ut_gtime();
- printf("\n\rTime at end is %02d:%02d:%02d.%02d", hour_,minute_,sec_,hsec_);
-
- printf("\n\n\rPhase 2 - Convert long integer date & time (and global hr & min) to strings");
- ldate = ut_datel();
- ut_ldatestr(datestr,ldate);
- printf("\n\rLong integer date is %8ld", ldate);
- printf("\n\rDate in a string is %s", datestr);
- ltime = ut_timel();
- ut_ldates(&adate,ldate);
- printf("\n\rDate in structure from ut_ldates is %02d/%02d/%d",
- adate.mo, adate.dy, adate.yr);
- dateoptf_|=DYR2F;
- ut_ldates(&adate,ldate);
- printf("\n\rDate in structure from ut_ldates with 2 digit YR is %02d/%02d/%d",
- adate.mo, adate.dy, adate.yr);
- ut_ltimestr(timestr,ltime);
- printf("\n\rLong integer time is %8ld", ltime);
- printf("\n\rTime in a string is %s", timestr);
- timeoptf_|=TSECF;
- ut_ltimestr(timestr,ltime);
- printf("\n\rLong integer time is %8ld", ltime);
- printf("\n\rTime in a string with seconds is %s", timestr);
- ut_gtime();
- timeoptf_=0;
- ut_hmtimestr(timestr,hour_,minute_);
- printf("\n\rHours & minutes are %02d:%02d", hour_, minute_);
- printf("\n\rHr & min in a string %s", timestr);
-
- printf("\n\n\rPress <CR> to continue with next phase");
- kb_getc();
-
- ut_gtod();
- printf("\n\n\rPhase 3 - Get day of week integer & name, month name, etc");
- i = ut_today();
- printf("\n\rToday's day of week integer is %d (Sunday = 0)", i);
- ptr = ut_todaystr();
- printf("\n\rToday's day of week name is %s", ptr);
-
- printf("\n\nEND OF TEST - Press any key to exit...");
- kb_getc();
- co_clr(); /* clear screen */
- }
-