home *** CD-ROM | disk | FTP | other *** search
- /*--------------------------------------------------------------------------*/
- /* */
- /* XBBS SOURCE CODE copyright (c) 1990 by M. Kimes */
- /* All Rights Reserved */
- /* */
- /* For complete details of the licensing restrictions, please refer */
- /* to the License agreement, which is published in its entirety in */
- /* the in the file LICENSE.XBS. */
- /* */
- /* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
- /* XBBS LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
- /* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
- /* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT M. KIMES */
- /* AT THE ADDRESS LISTED BELOW. IN NO EVENT SHOULD YOU PROCEED TO USE */
- /* THIS FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE XBBS LICENSING */
- /* AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE ABLE TO REACH WITH */
- /* M. KIMES */
- /* */
- /* */
- /* You can contact M. Kimes at the following address: */
- /* */
- /* M. Kimes 1:380/16.0@FidoNet */
- /* 542 Merrick (318)222-3455 data */
- /* Shreveport, LA 71104 */
- /* */
- /* */
- /* Please feel free to contact me at any time to share your comments about */
- /* my software and/or licensing policies. */
- /* */
- /*--------------------------------------------------------------------------*/
- /*======================================================================*/
- /* XBBS Bulletin Board System.....Time routines */
- /*======================================================================*/
-
- #include "msg.h"
- #include "xext.h"
-
-
- ulong pascal getxbbstime (void) { /* General purpose user timer */
-
- int min;
- int hour;
- struct time dos_time;
- char tempause;
- register word x;
- static ulong xbbs_time;
- static int warned;
- static int lastmin;
-
- gettime(&dos_time);
- hour=dos_time.ti_hour-starter.ti_hour;
- min=dos_time.ti_min-starter.ti_min;
- if (dos_time.ti_hour<starter.ti_hour) hour=hour+24;
- xbbs_time=(long)((hour)*3600)+((min)*60)+(dos_time.ti_sec-starter.ti_sec);
- if (lastmin!=min) {
- lastmin=min;
- if (!conf.whichstat || conf.whichstat==3) redraw_stat(NULL);
- if (timer_off) return (xbbs_time);
- for (x=0;x<10;x++) {
- if (event[x].secsleft) {
- if (((ulong)timelimit*60L)<(xbbs_time+event[x].secsleft)) {
- event[x].secsleft=0;
- readfile(event[x].filename,0,0,1);
- }
- }
- }
- }
-
- if (timer_off) return (xbbs_time);
- if (((long)(timelimit*60)<(xbbs_time+120L)) and (!warned)) {
-
- char temp[81];
-
- warned++;
- tempause=pauser;
- sprintf(temp,"\n\07WARNING: Only %u mins left!\n",(word)((long)timelimit-(xbbs_time/60L)));
- printm(temp);
- pauser=tempause;
- }
- if (((long)(timelimit*60) > ((xbbs_time+1L)+120L)) and (warned)) warned=0;
-
- if ((long)(timelimit*60) < (xbbs_time+1)) {
- timer_off=1;
- leaving++;
- say_prompt(176);
- pauser=0;
- say_prompt(177);
- logoff();
- userno=0;
- exit(254);
- }
- return(xbbs_time);
- }
-
-
-
- void pascal adjust_time (char type) { /* Turn timer on and off */
-
- if (!type) {
- timer_off=1;
- hold_time = timelimit-(word)(getxbbstime()/60L);
- return;
- }
- if (type) {
- gettime(&starter);
- timelimit=hold_time;
- timer_off=0;
- }
- }
-
-
-
- char * pascal fidodate (void) { /* Returns proper Fidonet msg datestring */
-
- char months[12][4]={
- "Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec"
- };
- static char fdate[20];
- struct date dos_date;
- struct time dos_time;
-
- /* 26 Jul 89 06:23:47 */
-
- getdate(&dos_date);
- gettime(&dos_time);
-
- sprintf(fdate,"%02hu %s %02d %02hu:%02hu:%02hu",dos_date.da_day,months[dos_date.da_mon-1],dos_date.da_year%100,dos_time.ti_hour,dos_time.ti_min,dos_time.ti_sec);
- return(fdate);
- }
-