]> git.mxchange.org Git - flightgear.git/commitdiff
Changes contributed by Durk Talsma to allow the user to specify a startup
authorcurt <curt>
Sun, 11 Apr 1999 13:19:29 +0000 (13:19 +0000)
committercurt <curt>
Sun, 11 Apr 1999 13:19:29 +0000 (13:19 +0000)
date/time.

12 files changed:
Simulator/Astro/moon.cxx
Simulator/Astro/moon.hxx
Simulator/Astro/solarsystem.cxx
Simulator/Astro/star.cxx
Simulator/Astro/star.hxx
Simulator/Main/3dfx.sh
Simulator/Main/GLUTmain.cxx
Simulator/Main/options.cxx
Simulator/Main/options.hxx
Simulator/Main/views.cxx
Simulator/Time/fg_time.cxx
Simulator/Time/fg_time.hxx

index 4df64ae123833216a4556b496ddbfdc899759ff5..970328a2342fe59828b39c7fa1f1f82937bb40ae 100644 (file)
@@ -308,8 +308,8 @@ void Moon::newImage()
   int moonSize = 750;
 
   GLfloat moonColor[4] = {0.85, 0.75, 0.35, 1.0};
-  GLfloat black[4] = {0.0, 0.0,0.0,1.0};
-  GLfloat white[4] = {1.0, 1.0,1.0,1.0};
+  GLfloat black[4] = {0.0, 0.0, 0.0, 1.0};
+  GLfloat white[4] = {1.0, 1.0, 1.0, 0.0};
   
   if( moon_angle*RAD_TO_DEG < 100 ) 
     {
@@ -341,7 +341,7 @@ void Moon::newImage()
        FG_LOG( FG_GENERAL, FG_INFO, 
                "Ra = (" << (RAD_TO_DEG *rightAscension) 
                << "), Dec= (" << (RAD_TO_DEG *declination) << ")" );
-       xglTranslatef(0.0, 58600.0, 0.0);
+       xglTranslatef(0.0, 60000.0, 0.0);
        glEnable(GL_BLEND);  // BLEND ENABLED
 
        if (current_options.get_textures())
@@ -375,16 +375,24 @@ void Moon::newImage()
        if (current_options.get_textures())
          {
            glBindTexture(GL_TEXTURE_2D, moon_texid);                         
-           //glDisable(GL_LIGHTING);                                               // LIGHTING DISABLED
-           gluQuadricTexture(moonObject, GL_TRUE );   
+           // glDisable(GL_LIGHTING);    // LIGHTING DISABLED
+           gluQuadricTexture(moonObject, GL_TRUE );
+           // glDisable(GL_LIGHTING);
+           // glDisable(GL_TEXTURE_2D);  // TEXTURE DISABLED
          }
+       //glDisable(GL_LIGHTING); // for testing
+       //glDisable(GL_BLEND); // also for testing
+       //glColor3f(1.0, 0.0, 0.0); // also also for testing
        gluSphere(moonObject,  moonSize, 12, 12 );
-       glDisable(GL_TEXTURE_2D);                                             // TEXTURE DISABLED
-       glDisable(GL_BLEND);                                                  // BLEND DISABLED
+       //glDisable(GL_LIGHTING);         // LIGHTING DISABLED
+       //glColor4fv(white);
+       //glBlendFunc(GL_ZERO, GL_SRC_COLOR);     // Set alpha to zero
+       //gluSphere(moonObject,  moonSize, 12, 12 );
+       glDisable(GL_TEXTURE_2D);         // TEXTURE DISABLED
+       glDisable(GL_BLEND);              // BLEND DISABLED
       }
       xglPopMatrix();
-      glDisable(GL_LIGHTING);                                               // LIGHTING DISABLED
-
+      glDisable(GL_LIGHTING);
     }
   else
     {
@@ -392,8 +400,47 @@ void Moon::newImage()
 }
 
 
+void Moon::castShadow()
+{
+  fgLIGHT *l = &cur_light_params;
+  float moon_angle = l->moon_angle;
+  
+  /*double x_2, x_4, x_8, x_10;
+  GLfloat ambient;
+  GLfloat amb[4];*/
+  int moonSize = 750;
 
+  GLfloat moonColor[4] = {0.85, 0.75, 0.35, 1.0};
+  GLfloat black[4] = {0.0, 0.0, 0.0, 1.0};
+  GLfloat white[4] = {1.0, 1.0, 1.0, 0.0};
+  
+  if( moon_angle*RAD_TO_DEG < 100 ) 
+    {
+      xglPushMatrix();
+      {
+       //xglRotatef(-90, 0.0, 0.0, 1.0);
+       xglRotatef(((RAD_TO_DEG * rightAscension)- 90.0), 0.0, 0.0, 1.0);
+       xglRotatef((RAD_TO_DEG * declination), 1.0, 0.0, 0.0);
+       
+       FG_LOG( FG_GENERAL, FG_INFO, 
+               "Ra = (" << (RAD_TO_DEG *rightAscension) 
+               << "), Dec= (" << (RAD_TO_DEG *declination) << ")" );
+       xglTranslatef(0.0, 60000.0, 0.0);
+       glEnable(GL_BLEND);                 // BLEND ENABLED
+
+       glDisable(GL_LIGHTING);             // LIGHTING DISABLED
+       //glColor4fv(white);
+       glColor4f(1.0, 1.0, 1.0, 0.0);
+       glBlendFunc(GL_ZERO, GL_SRC_COLOR); // Set alpha to zero
+       //glBlendFunc(GL_ZERO,GL_ZERO);
+       gluSphere(moonObject,  moonSize, 12, 12 );
+       glDisable(GL_TEXTURE_2D);           // TEXTURE DISABLED
+       glDisable(GL_BLEND);                // BLEND DISABLED
+      }
+      xglPopMatrix();
 
-
-
-
+    }
+  else
+    {
+    }
+}
index 62451601e99fd3bd485858d890483d8956a4049c..5f728bea245df2b48f4e628a0a65c0ba374a2817 100644 (file)
@@ -50,6 +50,7 @@ public:
   ~Moon();
   void updatePosition(FGTime *t, Star *ourSun);
   void newImage();
+  void castShadow();
 };
 
 
index 33bbe545600bc465b07370dda9c897b0d6f78165..d721472656b8988b676b156bcb56cdb2b1944e02 100644 (file)
@@ -140,7 +140,9 @@ void SolarSystem::rebuild()
     // Step 2b:  Add the sun
     //xglPushMatrix();
     //{
-      ourSun->newImage();
+    //ourSun->drawHalo();
+    //earthsMoon->castShadow();
+    ourSun->newImage();
       //}
     //xglPopMatrix();
     // Step 2c: Add the planets
index 8fa7fa906523bd7aad3352d02d07bb1be0c19f46..2e7393d8f36a13c461561a7f82b9f904d5bb7e3d 100644 (file)
@@ -242,9 +242,9 @@ void Star::newImage(void)
          //glEnable(GL_BLEND);
          //glDisable(GL_LIGHTING);
          glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
-         //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);  
+         glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);  
          glBindTexture(GL_TEXTURE_2D, sun_texid);
-      
+
          glBegin(GL_QUADS);
          glTexCoord2f(0.0f, 0.0f); glVertex3f(-5000, 0.0, -5000);
          glTexCoord2f(1.0f, 0.0f); glVertex3f( 5000, 0.0, -5000);
@@ -252,19 +252,111 @@ void Star::newImage(void)
          glTexCoord2f(0.0f, 1.0f); glVertex3f(-5000, 0.0,  5000);
          glEnd();
        }
-      xglDisable(GL_TEXTURE_2D);
-      glDisable(GL_BLEND);
+      xglDisable(GL_TEXTURE_2D);    // TEXTURE DISABLED
+      glDisable(GL_BLEND);          // BLEND DISABLED
     }
+
     glPopMatrix();
-    glPushMatrix();
+    glDisable(GL_LIGHTING);
+    /*glPushMatrix(); // Draw a black object, that serves as the moon's shadow.
     {
       xglRotatef(((RAD_TO_DEG * rightAscension)- 90.0), 0.0, 0.0, 1.0);
       xglRotatef((RAD_TO_DEG * declination), 1.0, 0.0, 0.0);
-      xglTranslatef(0,58600,0);
+      xglTranslatef(0,60000,0);
+      //xglTranslatef(0,58600,0);
+      //gluSphere( SunObject,  sun_size, 10, 10 );
+      glEnable(GL_BLEND);
+      glBlendFunc(GL_ZERO, GL_ZERO);
+      xglColor4f(0.0, 0.0, 0.0, 0.0);
       gluSphere( SunObject,  sun_size, 10, 10 );
     }
+    glPopMatrix();*/
+    glDisable(GL_BLEND);
+    glPushMatrix();
+    {     
+      //xglEnable(GL_BLEND);
+      //xglBlendFunc(GL_SRC_ALPHA, GL_ONE);
+      xglRotatef(((RAD_TO_DEG * rightAscension)- 90.0), 0.0, 0.0, 1.0);
+      xglRotatef((RAD_TO_DEG * declination), 1.0, 0.0, 0.0);
+      xglColor4fv(amb);
+      xglTranslatef(0,60000,0);
+      gluSphere( SunObject,  sun_size, 10, 10 );
+      }
     glPopMatrix();
     glDisable(GL_TEXTURE_2D);                                             // TEXTURE DISABLED
     glDisable(GL_BLEND);                                                  // BLEND DISABLED  
   }
 }
+
+  
+void Star::drawHalo(void)
+{
+  /*static float stars[3];
+  stars[0] = 0.0;
+  stars[1] = 0.0;
+  stars[2] = 1.0;*/
+  
+  fgLIGHT *l = &cur_light_params;
+  float sun_angle = l->sun_angle;
+  
+  if( sun_angle*RAD_TO_DEG < 100 ) { // else no need to draw sun
+    
+    
+    double x_2, x_4, x_8, x_10;
+    GLfloat ambient;
+    GLfloat amb[4];
+    int sun_size = 750;
+    
+    // daily variation sun gets larger near horizon
+    /*if(sun_angle*RAD_TO_DEG > 84.0 && sun_angle*RAD_TO_DEG < 95)
+      {
+      double sun_grow = 9*fabs(94-sun_angle*RAD_TO_DEG);
+      sun_size = (int)(sun_size + sun_size * cos(sun_grow*DEG_TO_RAD));
+      }*/
+    x_2 = sun_angle * sun_angle;
+    x_4 = x_2 * x_2;
+    x_8 = x_4 * x_4;
+    x_10 = x_8 * x_2;
+    ambient = (float)(0.4 * pow (1.1, - x_10 / 30.0));
+    if (ambient < 0.3) ambient = 0.3;
+    if (ambient > 1.0) ambient = 1.0;
+    
+    amb[0] = ((ambient * 6.0)  - 1.0); // minimum value = 0.8
+    amb[1] = ((ambient * 11.0) - 3.0); // minimum value = 0.3
+    amb[2] = ((ambient * 12.0) - 3.6); // minimum value = 0.0
+    amb[3] = 1.00;
+    
+    if (amb[0] > 1.0) amb[0] = 1.0;
+    if (amb[1] > 1.0) amb[1] = 1.0;
+    if (amb[2] > 1.0) amb[2] = 1.0;
+    xglColor3fv(amb);
+    glPushMatrix();
+    {
+      xglRotatef(((RAD_TO_DEG * rightAscension)- 90.0), 0.0, 0.0, 1.0);
+      xglRotatef((RAD_TO_DEG * declination), 1.0, 0.0, 0.0);
+      xglTranslatef(0,60000,0);
+      if (current_options.get_textures())
+       {
+         glEnable(GL_TEXTURE_2D);                                             // TEXTURE ENABLED
+         glEnable(GL_BLEND);                                                  // BLEND ENABLED
+         
+         //glEnable(GL_TEXTURE_2D);
+         //glEnable(GL_BLEND);
+         //glDisable(GL_LIGHTING);
+         //glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+         //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);  
+         glBindTexture(GL_TEXTURE_2D, sun_texid);
+         
+         glBegin(GL_QUADS);
+         glTexCoord2f(0.0f, 0.0f); glVertex3f(-5000, 0.0, -5000);
+         glTexCoord2f(1.0f, 0.0f); glVertex3f( 5000, 0.0, -5000);
+         glTexCoord2f(1.0f, 1.0f); glVertex3f( 5000, 0.0,  5000);
+         glTexCoord2f(0.0f, 1.0f); glVertex3f(-5000, 0.0,  5000);
+         glEnd();
+       }
+      xglDisable(GL_TEXTURE_2D);                                             // TEXTURE DISABLED
+      glDisable(GL_BLEND);                                                   // BLEND DISABLED
+    }
+    glPopMatrix();
+  }
+}
index 6eb7a4c901c56a95736bf35ef2fe21dd561253a0..0de6713ac8f405cad4c0b4b22d1c04d003911634 100644 (file)
@@ -51,6 +51,7 @@ public:
   double getys();
   double getDistance();
   void newImage();
+  void drawHalo();
 };
 
 
index cb766b74398503d3b34d7510e3195a90b14c3432..9f15e8f5304beaccaeb2452b0c0566b4db5a7564 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-WINDOW=YES
+WINDOW=NO
 
 if [ $WINDOW = "YES" ]; then
     # in a window (slow hack)
index f50784ec49f8c2cfadd7494835ec51691724e782..8e561e2a2f2ded0fdbc96af1d137ba8294ca8146 100644 (file)
@@ -304,6 +304,7 @@ static void fgRenderFrame( void ) {
 
        // draw stars and planets
        fgStarsRender();
+       //xglEnable(GL_DEPTH_TEST);
        SolarSystem::theSolarSystem->draw();
 
        xglPopMatrix();
index 9bc2f3b044f933ac6246437e4734623e3e84bcee..2ee0db0ed00e9e09f801a42b7b8b6cccbe6425d1 100644 (file)
@@ -42,6 +42,7 @@ bool global_fullscreen = true;
 #include <Misc/fgstream.hxx>
 #include <FDM/flight.hxx>
 #include <Include/fg_constants.h>
+#include <Time/fg_time.hxx>
 #include <Main/options.hxx>
 
 #include "fg_serial.hxx"
@@ -158,7 +159,9 @@ fgOPTIONS::fgOPTIONS() :
     tris_or_culled(0),
        
     // Time options
-    time_offset(0)
+    time_offset(0),
+    start_gst(0),
+    start_lst(0)
 
 {
     // set initial values/defaults
@@ -267,6 +270,117 @@ fgOPTIONS::parse_time(const string& time_in) {
 }
 
 
+long int fgOPTIONS::parse_date( const string& date)
+{
+  struct tm gmt;
+  char * date_str, num[256];
+  int i;
+  // initialize to zero
+  gmt.tm_sec = 0;
+  gmt.tm_min = 0;
+  gmt.tm_hour = 0;
+  gmt.tm_mday = 0;
+  gmt.tm_mon = 0;
+  gmt.tm_year = 0;
+  gmt.tm_isdst = 0; // ignore daylight savingtime for the moment
+  date_str = (char *)date.c_str();
+  // get year
+    if ( strlen(date_str) ) {
+       i = 0;
+       while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
+           num[i] = date_str[0];
+           date_str++;
+           i++;
+       }
+       if ( date_str[0] == ':' ) {
+           date_str++;
+       }
+       num[i] = '\0';
+       gmt.tm_year = atoi(num) - 1900;
+    }
+   // get month
+    if ( strlen(date_str) ) {
+       i = 0;
+       while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
+           num[i] = date_str[0];
+           date_str++;
+           i++;
+       }
+       if ( date_str[0] == ':' ) {
+           date_str++;
+       }
+       num[i] = '\0';
+       gmt.tm_mon = atoi(num) -1;
+    }
+    // get day
+    if ( strlen(date_str) ) {
+       i = 0;
+       while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
+           num[i] = date_str[0];
+           date_str++;
+           i++;
+       }
+       if ( date_str[0] == ':' ) {
+           date_str++;
+       }
+       num[i] = '\0';
+       gmt.tm_mday = atoi(num);
+    }
+    // get hour
+    if ( strlen(date_str) ) {
+       i = 0;
+       while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
+           num[i] = date_str[0];
+           date_str++;
+           i++;
+       }
+       if ( date_str[0] == ':' ) {
+           date_str++;
+       }
+       num[i] = '\0';
+       gmt.tm_hour = atoi(num);
+    }
+    // get minute
+    if ( strlen(date_str) ) {
+       i = 0;
+       while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
+           num[i] = date_str[0];
+           date_str++;
+           i++;
+       }
+       if ( date_str[0] == ':' ) {
+           date_str++;
+       }
+       num[i] = '\0';
+       gmt.tm_min = atoi(num);
+    }
+    // get second
+    if ( strlen(date_str) ) {
+       i = 0;
+       while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
+           num[i] = date_str[0];
+           date_str++;
+           i++;
+       }
+       if ( date_str[0] == ':' ) {
+           date_str++;
+       }
+       num[i] = '\0';
+       gmt.tm_sec = atoi(num);
+    }
+    time_t theTime = FGTime::cur_time_params->get_gmt(gmt.tm_year,
+                                                      gmt.tm_mon,
+                                                     gmt.tm_mday,
+                                                     gmt.tm_hour,
+                                                     gmt.tm_min,
+                                                     gmt.tm_sec);
+    //printf ("Date is %s\n", ctime(&theTime));
+    //printf ("in seconds that is %d\n", theTime);
+    //exit(1);
+    return (theTime);
+}
+
+
 // parse degree in the form of [+/-]hhh:mm:ss
 double
 fgOPTIONS::parse_degree( const string& degree_str) {
@@ -492,6 +606,10 @@ int fgOPTIONS::parse_option( const string& arg ) {
        tile_diameter = tile_radius * 2 + 1;
     } else if ( arg.find( "--time-offset=" ) != string::npos ) {
        time_offset = parse_time_offset( (arg.substr(14)) );
+    } else if (arg.find( "--start-date-gmt=") != string::npos ) {
+        start_gst = parse_date( (arg.substr(17)) );
+    } else if (arg.find( "--start-data-lst=") != string::npos ) {
+        start_lst = parse_date( (arg.substr(17)) );
     } else if ( arg == "--hud-tris" ) {
        tris_or_culled = 0;     
     } else if ( arg == "--hud-culled" ) {
@@ -632,6 +750,8 @@ void fgOPTIONS::usage ( void ) {
        
     printf("Time Options:\n");
     printf("\t--time-offset=[+-]hh:mm:ss:  offset local time by this amount\n");
+    printf("\t--start-date-gmt=yyyy:mm:dd:hh:mm:ss: specify a starting date/time. Time is Greenwich Mean Time\n");
+    printf("\t--start-date-lst=yyyy:mm:dd:hh:mm:ss: specify a starting date/time. Uses local sidereal time\n");
 }
 
 
index 8320caeba0accca2fad25b0108c2d357226715ef..f97c58fe5a2b2442b4de4f92c9d4e74babbb2085 100644 (file)
@@ -140,6 +140,8 @@ private:
 
     // Time options
     int time_offset;   // Offset true time by this many seconds
+    long int start_gst;     // Specify a greenwich sidereal time (gst)
+    long int start_lst;     // Specify a local sidereal time (lst)
 
     // Serial Ports, we currently support up to four channels
     // fgSerialPortKind port_a_kind;  // Port a kind
@@ -202,6 +204,8 @@ public:
     inline int get_tris_or_culled() const { return tris_or_culled; }
 
     inline int get_time_offset() const { return time_offset; }
+    inline long int get_start_gst() const { return start_gst; };
+    inline long int get_start_lst() const { return start_lst; }
 
     inline str_container get_port_options_list() const { 
        return port_options_list;
@@ -228,6 +232,7 @@ public:
 private:
 
     double parse_time( const string& time_str );
+    long int parse_date( const string& date_str );
     double parse_degree( const string& degree_str );
     int parse_time_offset( const string& time_str );
     int parse_tile_radius( const string& arg );
index 551866778e64ae672de85fc51fadff2d801b56ff..240aaf8f98c59dcd213a8d7f8016b7ed3de4b33d 100644 (file)
@@ -1006,5 +1006,3 @@ FGView::SphereClip( const Point3D& cp, const double radius )
 // Destructor
 FGView::~FGView( void ) {
 }
-
-
index e57d1a590204df0ca0ae5116ee2440b4f949aab1..6fdfd11b24ec38acfb09969a8a428c1d7a3200a4 100644 (file)
@@ -85,14 +85,54 @@ FGTime::~FGTime()
 }
 
 
-// Initialize the time dependent variables
+// Initialize the time dependent variables (maybe I'll put this in the
+// constructor later)
 void FGTime::init() 
 {
     FG_LOG( FG_EVENT, FG_INFO, "Initializing Time" );
     gst_diff = -9999.0;
     FG_LOG( FG_EVENT, FG_DEBUG, 
            "time offset = " << current_options.get_time_offset() );
-    warp = current_options.get_time_offset();
+    time_t timeOffset = current_options.get_time_offset();
+    time_t gstStart = current_options.get_start_gst();
+    time_t lstStart = current_options.get_start_lst();
+
+    // would it be better to put these sanity checks in the options
+    // parsing code? (CLO)
+    if (timeOffset && gstStart)
+       {
+           FG_LOG( FG_EVENT, FG_ALERT, "Error: you specified both a time offset and a gst. Confused now!" );
+           current_options.usage();
+           exit(1);
+       }
+    if (timeOffset && lstStart)
+       {
+           FG_LOG( FG_EVENT, FG_ALERT, "Error: you specified both a time offset and a lst. Confused now!" );
+           current_options.usage();
+           exit(1);
+       }
+    if (gstStart && lstStart)
+       {
+           FG_LOG( FG_EVENT, FG_ALERT, "Error: you specified both a time offset and a lst. Confused now!" );
+           current_options.usage();
+           exit(1);
+       }
+    cur_time = time(NULL); 
+    if (gstStart)
+       warp = gstStart - cur_time;
+    else if (lstStart) // I need to use the time zone info for this one, but I'll do that later.
+       // Until then, Gst and LST are the same 
+       {
+           warp = lstStart - cur_time;
+       }
+    else if (timeOffset)
+       {
+           warp = timeOffset;
+       }
+    else
+       {
+           warp = 0;
+       }
     warp_delta = 0;
     pause = current_options.get_pause();
 }
@@ -172,7 +212,6 @@ void FGTime::utc_gst ()
 
 double FGTime::sidereal_precise (double lng) 
 {
-    double gst;
     double lstTmp;
 
     /* printf ("Current Lst on JD %13.5f at %8.4f degrees West: ", 
@@ -182,7 +221,6 @@ double FGTime::sidereal_precise (double lng)
     lng *= DEG_TO_RAD;
 
     // compute LST and print
-    //gst = utc_gst ();
     utc_gst();
     lstTmp = gst - RADHR (lng);
     lstTmp -= 24.0*floor(lst/24.0);
@@ -205,7 +243,7 @@ double FGTime::sidereal_course(double lng)
     //gmt = t->gmt;
     //now = t->cur_time;
     now = cur_time;
-    start_gmt = get_start_gmt(gmt->tm_year);
+    start_gmt = get_gmt(gmt->tm_year, 2, 21, 12, 0, 0);
   
     FG_LOG( FG_EVENT, FG_DEBUG, "  COURSE: GMT = " << format_time(gmt, tbuf) );
     FG_LOG( FG_EVENT, FG_DEBUG, "  March 21 noon (GMT) = " << start_gmt );
@@ -303,7 +341,7 @@ void FGTime::update(FGInterface *f)
 
 /******************************************************************
  * The following are some functions that were included as FGTime
- * members, although they currenty don't make used of any of the
+ * members, although they currently don't make used of any of the
  * class's variables. Maybe this'll change in the future
  *****************************************************************/
 
@@ -321,7 +359,8 @@ void FGTime::update(FGInterface *f)
 // If you are having problems with incorrectly positioned astronomical
 // bodies, this is a really good place to start looking.
 
-time_t FGTime::get_start_gmt(int year) {
+time_t FGTime::get_gmt(int year, int month, int day, int hour, int min, int sec)
+{
     struct tm mt;
 
     // For now we assume that if daylight is not defined in
@@ -336,12 +375,12 @@ time_t FGTime::get_start_gmt(int year) {
 #       define TIMEZONE_OFFSET_WORKS 1
 #   endif
 
-    mt.tm_mon = 2;
-    mt.tm_mday = 21;
+    mt.tm_mon = month;
+    mt.tm_mday = day;
     mt.tm_year = year;
-    mt.tm_hour = 12;
-    mt.tm_min = 0;
-    mt.tm_sec = 0;
+    mt.tm_hour = hour;
+    mt.tm_min = min;
+    mt.tm_sec = sec;
     mt.tm_isdst = -1; // let the system determine the proper time zone
 
 #   if defined( MK_TIME_IS_GMT )
index 96a151cdc178badc8131b5588d7bb3b0eaee40cf..2a146cda16a5860bffcd95ff1fad33e35912f7b0 100644 (file)
@@ -124,7 +124,9 @@ public:
 
     // Some other stuff which were changed to FGTime members on
     // questionable grounds -:)
-    time_t get_start_gmt(int year);
+    // time_t get_start_gmt(int year);
+    time_t get_gmt(int year, int month, int day, 
+                  int hour, int minute, int second);
     char* format_time( const struct tm* p, char* buf );
     long int fix_up_timezone( long int timezone_orig );
 };