home *** CD-ROM | disk | FTP | other *** search
- /*=========================================================================
- Starglb.c -- This module handles initialization and global functions
- for the StarChart program.
-
- Credits for Star Chart:
- Robert L. Hill of the Orange County, CA. Amiga Friends User Group
- wrote the original version of StarChart in AmigaBasic
- The star data and many of the main functions of this
- version are derived from that program.
-
- Ray R. Larson wrote the c version 1.0 of StarChart, 'intuitionizing'
- and enhancing the speed and functions of the original.
-
- Copyright (c) 1986 by Ray R. Larson
-
- This program may be freely distributed and copied, but may not be sold
- without the permission of the author. If you modify or enhance it,
- please include the above credits (and please send me a copy!).
-
- Ray R. Larson
- 6425 Central Ave. #304
- El Cerrito, CA 94530
-
- BitNet LARSON@UCBCMSA
- =========================================================================*/
- /*------------Header file for all of the standard stuff----*/
- /*-------------plus definitions of global structures-------*/
- #include "star.h"
- #include <graphics/gfxmacros.h>
- #include <time.h>
-
- /*------------------ extern vars ------------------*/
-
- extern LONG MathTransBase;
- extern LONG MathBase;
- extern struct star_rec StarTable[];
- extern char *Greek[];
- extern struct cons_rec Constel[];
- extern struct RastPort *rp;
- extern struct Window *w;
- extern struct Screen *scr; /* pointer to the custom screen - RRL */
- extern struct ViewPort *vport;
- extern struct FileHandle *Open();
- extern FLOAT cos(), sin(), tan();
- extern struct TextAttr TxtAt_Plain,TxtAt_BIU,TxtAt_BU,TxtAt_BI,TxtAt_B,
- TxtAt_IU,TxtAt_I,TxtAt_U;
- BOOL CalcParm = FALSE;
- extern UWORD defaultCT[32], CTable[32], *ctabptr;
- extern UBYTE DefaultStartFile[];
-
- /*------------------ global vars ------------------*/
-
- struct ParamStruct DefaultParms, Parms; /* parameter structures */
- extern struct ParamStruct workParms;
-
- /* Days per month - used in date calculations */
- SHORT Dd[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
- SHORT DSum[13] = {0,0,31,59,90,120,151,181,212,243,273,304,334};
-
- /* values based on pi, used in angular calculations - PI defined in mathffp.h*/
- FLOAT P1, P12 , P15;
-
- /* values used in determining the type of display for an object */
- FLOAT MaxPlus = 2.0, MaxWhite = 11.1;
-
- SHORT TimeDelay = 1; /* time delay is 1 for real time. Max is 1800 */
- /* for one hour per second of program time */
- SHORT SecondsCount = 0;
-
- struct Coord coords[MAXSTARS]; /* x and y screen coordinates for stars */
-
-
- /**********************************************************************
- * IntuiTexts for the horizon labels.
- **********************************************************************/
-
- struct IntuiText LeftLabel = {
- 15, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 30, 85, /* LeftEdge, TopEdge */
- &TxtAt_Plain, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)" ",
- NULL
- };
-
- struct IntuiText RightLabel = {
- 15, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 601, 85, /* LeftEdge, TopEdge */
- &TxtAt_Plain, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)" ",
- &LeftLabel
- };
-
- struct IntuiText BotLabel = {
- 15, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 315, 171, /* LeftEdge, TopEdge */
- &TxtAt_Plain, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)" ",
- &RightLabel
- };
-
-
-
- /**********************************************************************
- * IntuiTexts for the parameter display area
- **********************************************************************/
- UBYTE STBuf[10];
- struct IntuiText SidTimeText = {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 450, 177, /* LeftEdge, TopEdge */
- &TxtAt_Plain, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)&STBuf[0],
- NULL
- };
-
- UBYTE DateBuf[12];
- struct IntuiText DateText = {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 243, 177, /* LeftEdge, TopEdge */
- &TxtAt_Plain, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)&DateBuf[0],
- &SidTimeText /* NextText */
- };
-
- UBYTE LatBuf[4];
- struct IntuiText LatText = {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 483, 167, /* LeftEdge, TopEdge */
- &TxtAt_Plain, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)&LatBuf[0],
- &DateText /* NextText */
- };
-
- UBYTE LnMinBuf[4];
- struct IntuiText LongMinText = {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 305, 167, /* LeftEdge, TopEdge */
- &TxtAt_Plain, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)&LnMinBuf[0],
- &LatText /* NextText */
- };
-
- UBYTE LnDegBuf[6];
- struct IntuiText LongDegText = {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 230, 167, /* LeftEdge, TopEdge */
- &TxtAt_Plain, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)&LnDegBuf[0],
- &LongMinText /* NextText */
- };
-
-
- struct IntuiText DispText_5 = {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 333, 177, /* LeftEdge, TopEdge */
- &TxtAt_B, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)"Sidereal Time:",
- &LongDegText /* NextText */
- };
-
-
- struct IntuiText DispText_4 = {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 200, 177, /* LeftEdge, TopEdge */
- &TxtAt_B, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)"Date:",
- &DispText_5 /* NextText */
- };
-
-
- struct IntuiText DispText_3 = {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 508, 167, /* LeftEdge, TopEdge */
- &TxtAt_I, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)"Deg.",
- &DispText_4 /* NextText */
- };
-
-
- struct IntuiText DispText_2 = {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 398, 167, /* LeftEdge, TopEdge */
- &TxtAt_B, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)"Latitude:",
- &DispText_3 /* NextText */
- };
-
-
- struct IntuiText DispText_1 = {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 223, 167, /* LeftEdge, TopEdge */
- &TxtAt_I, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)" Deg. Min.",
- &DispText_2 /* NextText */
- };
-
-
- struct IntuiText DispText_0 = {
- 1, 0, /* FrontPen, BackPen */
- JAM2, /* DrawMode */
- 137, 167, /* LeftEdge, TopEdge */
- &TxtAt_B, /* ITextFont Pointer */
- /* The IText */
- (UBYTE *)"Longitude:",
- &DispText_1 /* NextText */
- };
-
-
-
-
- /**********************************************************************
- perform initialization of the screen and data structures (as needed)
- **********************************************************************/
- initialize()
- {
- struct FileHandle *filedes;
- LONG timestamp;
- struct tm *timedat;
-
-
- if((filedes = Open(&DefaultStartFile[0],MODE_OLDFILE))==NULL)
- { /* set defaults to local stuff (for me) */
- DefaultParms.LongitudeDeg =118;
- DefaultParms.LongitudeMin = 10;
- DefaultParms.Latitude = 34;
-
- /* read the system clock */
- timestamp = time(NULL);
- timedat = localtime(×tamp);
-
- DefaultParms.Month = timedat->tm_mon + 1;
- DefaultParms.Day = timedat->tm_mday;
- DefaultParms.Year= timedat->tm_year + 1900;
- DefaultParms.Hour = timedat->tm_hour;
- DefaultParms.Minute = timedat->tm_min;
- DefaultParms.Horizon = 0;/* zero for North, one for South */
- CalcParams(&DefaultParms); /* calculate sidereal time, GST, etc. from work */
- }
- else { /* read the default parameters from the file */
- Read(filedes,&DefaultParms,(LONG)sizeof(struct ParamStruct));
- Read(filedes,&CTable[0],(LONG)(32*sizeof(UWORD)));
- /* change the registers to the new colors */
- LoadRGB4(vport,&CTable,32L);
-
- Close(filedes);
- }
-
- /* global PI based values for calculations */
- P1 = PI/180.0;
- P12 = PI/12.0;
- P15 = P1 * 15.0;
-
- Parms = DefaultParms; /* set the current parms to the default */
-
- DisplayStars();
- DisplayAllText();
- }
- /***************************************************************************
- * SetEW - set labels for the east and west sides of the display
- ***************************************************************************/
- SetEW(horiz)
- SHORT horiz;
- {
- if (horiz) {
- RightLabel.IText = (UBYTE *)"W";
- LeftLabel.IText = (UBYTE *)"E";
- BotLabel.IText = (UBYTE *)"S";
- }
- else {
- RightLabel.IText = (UBYTE *)"E";
- LeftLabel.IText = (UBYTE *)"W";
- BotLabel.IText = (UBYTE *)"N";
- }
- PrintIText(rp,&BotLabel,0L,0L);
-
- }
-
- /***************************************************************************
- * PlotStar - draw a star into the display area. - must provide coords
- ***************************************************************************/
- PlotStar(magnitude,chartx,charty,highlight)
- FLOAT magnitude;
- LONG chartx, charty;
- SHORT highlight;
- {
- LONG starcolor;
- SetDrMd(rp,JAM1);
- if (highlight) SetAPen(rp,(LONG)(highlight + 10)); /* output star in color */
- else if (magnitude > MaxWhite) SetAPen(rp,12L); /* output in alternate blue */
- else
- {
- starcolor = (LONG) magnitude + 3.5; /* round up */
- if (starcolor > 10L) starcolor = 12L;
- SetAPen(rp,starcolor);
- }
-
- if (magnitude > MaxPlus) /* magnitude is an inverse measure */
- WritePixel(rp,chartx,charty);
- else
- { Move(rp,chartx-1L,charty);
- Draw(rp,chartx+1L,charty);
- Move(rp,chartx,charty-1L);
- Draw(rp,chartx,charty+1L);
- }
- } /* end of PlotStar */
-
- /***************************************************************************
- * BlinkStar - blink the star indicated by the table index number in red
- ***************************************************************************/
- BlinkStar (index,count,highlight,circle)
- SHORT index,count,highlight,circle;
- {
- SHORT i;
- FLOAT mag;
- LONG x, y;
-
- mag = StarTable[index].Mag;
- x = coords[index].x;
- y = coords[index].y;
-
- if (x == 0L) return;
-
- if (circle > 0)
- { SetDrMd(rp,COMPLEMENT);
- DrawEllipse(rp,x,y,(LONG)circle,(LONG)(circle / 2));
- }
-
- for (i=0; i < count; i++)
- {
- PlotStar(mag,x,y,highlight);
- Delay(25L);
- PlotStar(mag,x,y,0);
- Delay(10L);
- }
-
- if (circle > 0)
- { SetDrMd(rp,COMPLEMENT);
- DrawEllipse(rp,x,y,(LONG)circle,(LONG)(circle /2));
-
- }
- SetDrMd(rp,JAM1);
-
- } /* end of BlinkStar */
-
- /***************************************************************************
- * HighLightStar - Plot the star indicated by the table index number.
- ***************************************************************************/
- HighLightStar (index,highlight,circle)
- SHORT index,highlight,circle;
- {
- SHORT i;
- FLOAT mag;
- LONG x, y;
-
- mag = StarTable[index].Mag;
- x = coords[index].x;
- y = coords[index].y;
-
- if (x == 0L) return;
-
- PlotStar(mag,x,y,highlight);
- if (circle > 0)
- { SetDrMd(rp,COMPLEMENT);
- DrawEllipse(rp,x,y,(LONG)circle,(LONG)(circle /2));
- SetDrMd(rp,JAM1);
- }
-
- } /* end of HighLightStar */
-
- /***************************************************************************
- * PlotConst - Plot a constellation from a list of startable indexes.
- * If highlight is 1, the stars are output in red. If
- * highlight is 0, they are output in normal colors.
- ***************************************************************************/
- BOOL PlotConst(list,highlight,dispflag)
- SHORT list[], highlight, dispflag;
-
- {
- SHORT i, nstars, index;
- FLOAT mag;
- LONG x, y;
- BOOL visible, major;
-
- nstars = list[0];
- visible = FALSE;
- if (dispflag & 4) major = TRUE;
- else major = FALSE;
-
- /* highlight all the visible stars in the constellation list */
- for(i=1; i <= nstars; i++)
- { index = list[i];
- if (major && StarTable[index].GreekNum == 0) continue;
-
- mag = StarTable[index].Mag;
- x = coords[index].x;
- y = coords[index].y;
- if (x != 0L)
- { visible = TRUE;
- PlotStar(mag,x,y,highlight);
- }
-
- }
- /* if none of the stars were visible - return now */
- return(visible);
-
- } /* end of PlotConst */
-
- /***************************************************************************
- * PlotObjects - Plot Messier or NGC objects.
- ***************************************************************************/
- PlotObjects(type,highlight)
- char type;
- SHORT highlight;
-
- {
- SHORT i;
-
- for (i=1; i <= NumStars; i++)
- { if (coords[i].x != 0L) /* is it visible ? */
- { if (StarTable[i].GreekNum == 0)
- { /* not a major star */
- if (*(StarTable[i].StarName) == type)
- PlotStar(StarTable[i].Mag,
- coords[i].x,coords[i].y,highlight);
- }
- }
- }
-
- } /* end of PlotObjects */
-
- /***************************************************************************
- * CalcGst - calculate Greenwich time
- ***************************************************************************/
- FLOAT CalcGst(day,month)
- SHORT day, month;
- {
- FLOAT df,Gst;
-
- df = (FLOAT) day + DSum[month];
- Gst = 6.68 + (df * 4.0) / 60.0;
- if (Gst > 24.0) return(Gst - 24.0);
- else return(Gst);
-
- }
-
- /***************************************************************************
- * ClearChart - clear the star display area to black.
- ***************************************************************************/
- ClearChart()
- {
- SetAPen(rp,2L);
- RectFill(rp,CHARTLEFT,CHARTTOP,CHARTRIGHT,CHARTBOT);
- }
-
- /***************************************************************************
- * DisplayStars - Calculate the positions of the visible stars given the
- * current parms and plot them on the screen. Save positions in coords.
- ***************************************************************************/
- DisplayStars()
- {
- extern UBYTE WTMessage[];
- extern UBYTE WinTitle[]; /* default window title */
-
- sprintf(WTMessage,"Calculating Star Positions for Current Date and Time");
- SetWindowTitles(w,WTMessage,(UBYTE *)-1);
- CalcStars();
- SetWindowTitles(w,WinTitle,(UBYTE *)-1);
- ReDisplay();
- SetEW(Parms.Horizon);
-
- } /* end of DisplayStars */
-
- /***************************************************************************
- * CalcStars - Calculate the positions of the visible stars given the
- * current parms and plot them on the screen. Save positions in coords.
- ***************************************************************************/
- CalcStars()
- {
- FLOAT Xpos,Ypos, LatRad, LatPos, LatCOS, LatSIN, F;
- SHORT i;
- register FLOAT yeardif, RA, DC, xRad, yRad;
- BOOL visible;
- struct star_rec *ST;
- struct Coord *c;
-
- /* set some (variable) constants */
- yeardif = (FLOAT)(Parms.Year - 1950);
- LatRad = Parms.Latitude * P1;
- LatPos = 160.0 - (1.78 * Parms.Latitude);
- LatCOS = cos(LatRad);
- LatSIN = -sin(LatRad);
- F = 140.0 / 1.5708;
-
- /* for a little extra speed we will use pointers rather than array indexes */
- ST = &StarTable[1];
- c = &coords[1];
-
- for (i = 1; i <= NumStars; i++)
- {
- RA = ST->Ra;
- DC = ST->Dc;
-
- if (((Parms.Horizon == 0)&&(DC < 0.0)) || /* north view */
- ((Parms.Horizon == 1)&&
- ((DC > (FLOAT)Parms.Latitude)||
- (DC < (FLOAT)(Parms.Latitude - 90))) /* south view */
- ))
- { /* don't bother calculating if it will never be visible given the */
- /* current position and orientation. */
- c->x = 0L;
- c->y = 0L;
- ST++;
- c++;
- continue;
- }
-
- if (yeardif) {
- /* convert right Asc. and declination of star to radians */
- xRad = RA * P12;
- yRad = DC * P1;
-
-
- /* correct for year - uses mathffp routines*/
- Xpos = RA +
- (3.07 + 1.34 * sin(xRad) * tan(xRad))
- * yeardif / 3600.0;
-
-
- Ypos = DC + 20.0 * cos(yRad) * yeardif / 3600.0;
- }
- else { /* year is 1950 - basis for the star table */
- Xpos = RA;
- Ypos = DC;
- }
-
- /* modify the Xpos and Ypos for the date, time, location and horizon */
- if(Parms.Horizon == 0)
- visible = NorthView(&Xpos,&Ypos,LatRad,LatPos,LatCOS,LatSIN,F);
- else
- visible = SouthView(&Xpos,&Ypos,LatCOS,LatSIN);
-
- /* if the star is visible from the current location - save coords and */
- /* plot it on the display (not any more - actual plot is done in redisp */
- if(visible)
- { /* set the display coordinates */
- c->x = CHARTLEFT + (LONG)((2.0 * Xpos) + 0.5);
- c->y = (CHARTTOP+1L) + (LONG)(Ypos + 0.5);
- }
- else
- { c->x = 0L;
- c->y = 0L;
- }
-
- /* increment the pointers */
- ST++;
- c++;
- } /* end of for loop */
- } /* end of DisplayStars */
-
-
- /***************************************************************************
- * NorthView - calculate star position for Northern Sky
- * returns 1 if star is visible, zero if not visible from current location
- ***************************************************************************/
- BOOL NorthView (xposit,yposit,lat,LatPos,latcos,latsin,F)
- FLOAT *xposit, *yposit,lat,LatPos,latcos,latsin,F;
- {
- FLOAT DecRad,HourRad, Temp1, TempX, TempY;
- register FLOAT xpos, ypos;
-
- xpos = *xposit;
- ypos = *yposit;
-
- if (ypos < 0.0) return(0);
-
- /* convert declination, latitude, and local sidereal time to radians */
- DecRad = ypos * P1;
- HourRad = P12 * (Parms.Lst - xpos);
-
- /* eliminate stars below the horizon line */
- if(( latcos * cos(DecRad) * cos(HourRad))
- <( latsin * sin(DecRad))) return(0);
-
- xpos = xpos - Parms.Lst;
- ypos = ypos * P1;
-
- /* Map to scale for the display */
- xpos = (xpos * P15) - 1.5708;
-
- Temp1 = F * (1.5708 - abs(ypos));
- TempX = Temp1 * cos(xpos) + 140.0;
-
- TempY = Temp1 * sin(xpos) + LatPos;
-
- xpos = TempX;
- ypos = TempY;
-
- if((xpos > 279.0) || (xpos < 0.0)) return(0);
- if((ypos > 159.0) || (ypos < 0.0)) return(0);
-
- /* if we got to here it must be visible */
- *xposit = xpos;
- *yposit = ypos;
- return(1);
- } /* end of NorthView */
-
- /***************************************************************************
- * SouthView - calculate star position for Southern Sky
- * returns 1 if star is visible, zero if not visible from current location
- ***************************************************************************/
- BOOL SouthView (xposit,yposit,latcos,latsin)
- FLOAT *xposit, *yposit,latcos,latsin;
- {
- FLOAT DecRad,LatRad,HourRad, LatPos, Temp1;
- register FLOAT xpos, ypos;
-
- xpos = *xposit;
- ypos = *yposit;
-
- if (ypos > (FLOAT)Parms.Latitude) return(0);
-
- if (ypos < (FLOAT)(Parms.Latitude - 90)) return(0);
-
-
- /* convert declination, latitude, and local sidereal time to radians */
- DecRad = ypos * P1;
- HourRad = P12 * (Parms.Lst - xpos);
-
- /* eliminate stars below the horizon line */
- if(( latcos * cos(DecRad) * cos(HourRad))
- <( latsin * sin(DecRad))) return(0);
-
- xpos = Parms.Lst - xpos;
- if(xpos < -12.0) xpos += 24.0;
- if(xpos > 12.0) xpos -= 24.0;
- xpos = 140.0 + (23.33 * xpos);
-
- if((xpos > 279) || (xpos < 0)) return(0);
-
- ypos = 1.78 * (Parms.Latitude - ypos);
-
- if((ypos > 159.0) || (ypos < 0.0)) return(0);
-
- /* if we got to here it must be visible */
- *xposit = xpos;
- *yposit = ypos;
- return(1);
- } /* end of SouthView */
-
- /***************************************************************************
- * ReDisplay - Plots the stars currently in the coords table.
- ***************************************************************************/
- ReDisplay()
- {
- SHORT i;
- struct star_rec *S;
- struct Coord *c;
-
- ClearChart();
- S = &StarTable[1];
- c = &coords[1];
-
- for(i=1; i <= NumStars; i++)
- {if (c->x) /* if the coord is not 0 */
- PlotStar(S->Mag,c->x,c->y,0);
- S++;
- c++;
- }
- }
-
- /***************************************************************************
- * DisplayAllText - Print out the parameters and their labels in the
- * text display area;
- ***************************************************************************/
- DisplayAllText()
- {
- setlatdisp();
- setlndisp();
- setdatedisp();
- settimedisp();
- PrintIText(w->RPort,&DispText_0,-20L,13L);
- }
-
- /***************************************************************************
- * DispDateText - Format and print out the current date
- ***************************************************************************/
- DispDateText()
- {
- setdatedisp();
- PrintIText(w->RPort,&DateText,-20L,13L);
- }
-
- /***************************************************************************
- * DispTimeText - Format and print out the current time.
- ***************************************************************************/
- DispTimeText()
- {
- settimedisp();
- PrintIText(w->RPort,&SidTimeText,-20L,13L);
- }
-
- /***************************************************************************
- * DispDateTimeText - Format and print out both the date and time
- ***************************************************************************/
- DispDateTimeText()
- {
- setdatedisp();
- settimedisp();
- PrintIText(w->RPort,&DateText,-20L,13L);
- }
-
-
- /***************************************************************************
- * setlatdisp - Put current latitude into display buffer.
- ***************************************************************************/
- setlatdisp()
- {
- sprintf(&LatBuf[0],"%2d",Parms.Latitude);
- }
-
- /***************************************************************************
- * setlndisp - Put current longitude into display buffer.
- ***************************************************************************/
- setlndisp()
- {
- sprintf(&LnDegBuf[0], "%3d",Parms.LongitudeDeg);
- sprintf(&LnMinBuf[0], "%2d",Parms.LongitudeMin);
- }
-
- /***************************************************************************
- * setdatedisp - Put current date into display buffer.
- ***************************************************************************/
- setdatedisp()
- {
- sprintf(&DateBuf[0],"%2d/%2d/%4d",Parms.Month,Parms.Day,Parms.Year);
- }
-
- /***************************************************************************
- * settimedisp - Put current time into display buffer.
- ***************************************************************************/
- settimedisp()
- {
- sprintf(&STBuf[0],"%2d:%02d:%02d",Parms.Hr,Parms.Mn,SecondsCount);
- }
- /***************************************************************************
- * UpdateTime - increment the current time and date by the TimeDelay value
- ***************************************************************************/
- BOOL UpdateTime()
- {
- SHORT worksecs, workmins, workhours;
- BOOL datechange = FALSE;
- BOOL hourchange; /* display is updated each hour */
-
- hourchange = FALSE;
- SecondsCount += TimeDelay;
- if (SecondsCount < 60) DispTimeText();
- else
- { workhours = SecondsCount / 3600;
- workmins = SecondsCount % 3600;
- worksecs = workmins % 60;
- workmins = workmins / 60;
- SecondsCount = worksecs;
-
- workmins += Parms.Mn;
- workhours += Parms.Hr;
-
- if (workmins > 59)
- { workhours++;
- hourchange = TRUE;
- workmins -= 60;
- }
- Parms.Mn = workmins;
-
- if (workhours > 23)
- { Parms.Day++;
- workhours -= 24;
- datechange = TRUE;
- }
- Parms.Hr = workhours;
-
- if (datechange)
- { if (Parms.Day > Dd[Parms.Month])
- { Parms.Day -= Dd[Parms.Month];
- Parms.Month++;
- }
- if (Parms.Month > 12)
- { Parms.Year++;
- Parms.Month -= 12;
- }
- DispDateTimeText();
- }
- else DispTimeText();
- }
- Parms.Lst = (FLOAT)Parms.Hr
- + ((FLOAT)Parms.Mn / 60.0) + ((FLOAT)SecondsCount / 3600.0);
-
- return(hourchange);
- }
-
-