From 8087bae02a471710a155d249870f67e21c640379 Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 9 Sep 1999 00:17:06 +0000 Subject: [PATCH] Fiddling around with views, fdm data passing and management to try to be more sensible so we can do a more reasonable external view. Fixed some const incorrectness. --- src/Time/fg_time.cxx | 14 +++++++------- src/Time/fg_time.hxx | 4 ++-- src/Time/lowleveltime.cxx | 8 ++++---- src/Time/lowleveltime.h | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Time/fg_time.cxx b/src/Time/fg_time.cxx index fe31c5c9a..503503d6d 100644 --- a/src/Time/fg_time.cxx +++ b/src/Time/fg_time.cxx @@ -100,7 +100,7 @@ FGTime::~FGTime() // Initialize the time dependent variables (maybe I'll put this in the // constructor later) -void FGTime::init(FGInterface *f) +void FGTime::init(const FGInterface& f) { FG_LOG( FG_EVENT, FG_INFO, "Initializing Time" ); gst_diff = -9999.0; @@ -121,8 +121,8 @@ void FGTime::init(FGInterface *f) // printf ("Current greenwich mean time = %24s", asctime(gmtime(&cur_time))); // printf ("Current local time = %24s", asctime(localtime(&cur_time))); // time_t tmp = cur_time; - GeoCoord location(RAD_TO_DEG * f->get_Latitude(), - RAD_TO_DEG * f->get_Longitude()); + GeoCoord location(RAD_TO_DEG * f.get_Latitude(), + RAD_TO_DEG * f.get_Longitude()); GeoCoord* nearestTz = tzContainer->getNearest(location); @@ -316,7 +316,7 @@ double FGTime::sidereal_course(double lng) // Update time variables such as gmt, julian date, and sidereal time -void FGTime::update(FGInterface *f) +void FGTime::update(const FGInterface& f) { double gst_precise, gst_course; @@ -368,17 +368,17 @@ void FGTime::update(FGInterface *f) gst_diff = gst_precise - gst_course; - lst = sidereal_course(-(f->get_Longitude() * RAD_TO_DEG)) + gst_diff; + lst = sidereal_course(-(f.get_Longitude() * RAD_TO_DEG)) + gst_diff; } else { // course + difference should drift off very slowly gst = sidereal_course( 0.00 ) + gst_diff; - lst = sidereal_course( -(f->get_Longitude() * RAD_TO_DEG)) + gst_diff; + lst = sidereal_course( -(f.get_Longitude() * RAD_TO_DEG)) + gst_diff; } FG_LOG( FG_EVENT, FG_DEBUG, " Current lon=0.00 Sidereal Time = " << gst ); FG_LOG( FG_EVENT, FG_DEBUG, " Current LOCAL Sidereal Time = " << lst << " (" - << sidereal_precise(-(f->get_Longitude() * RAD_TO_DEG)) + << sidereal_precise(-(f.get_Longitude() * RAD_TO_DEG)) << ") (diff = " << gst_diff << ")" ); } diff --git a/src/Time/fg_time.hxx b/src/Time/fg_time.hxx index c87fc2403..f591eca39 100644 --- a/src/Time/fg_time.hxx +++ b/src/Time/fg_time.hxx @@ -118,10 +118,10 @@ public: void togglePauseMode() { pause = !pause; }; // Initialize the time dependent variables - void init(FGInterface *f); + void init(const FGInterface& f); // Update the time dependent variables - void update(FGInterface *f); + void update(const FGInterface& f); void cal_mjd (int mn, double dy, int yr); void utc_gst(); diff --git a/src/Time/lowleveltime.cxx b/src/Time/lowleveltime.cxx index 393096d8e..5b7bb2dd0 100644 --- a/src/Time/lowleveltime.cxx +++ b/src/Time/lowleveltime.cxx @@ -114,7 +114,7 @@ static size_t num_leaps; static struct leap *leaps = NULL; -static void fgtzset_internal (int always, char*tz); +static void fgtzset_internal (int always, const char *tz); static int fgtz_compute(time_t timer, const struct tm *tm); static int fgcompute_change(fgtz_rule *rule, int year); static struct ttinfo *fgfind_transition (time_t timer); @@ -162,7 +162,7 @@ struct tm _fgtmbuf; /* Return the `struct tm' representation of *T in local time. */ -struct tm * fgLocaltime (const time_t *t, char *tzName) +struct tm * fgLocaltime (const time_t *t, const char *tzName) { return fgtz_convert (t, 1, &_fgtmbuf, tzName); } @@ -170,7 +170,7 @@ struct tm * fgLocaltime (const time_t *t, char *tzName) /* Return the `struct tm' representation of *TIMER in the local timezone. Use local time if USE_LOCALTIME is nonzero, UTC otherwise. */ -struct tm * fgtz_convert (const time_t *timer, int use_localtime, struct tm *tp, char *tzName) +struct tm * fgtz_convert (const time_t *timer, int use_localtime, struct tm *tp, const char *tzName) { long int leap_correction; long int offsetCorr; // ADDED TO RESOLVE NON-ANSI FIELDS IN struct tm @@ -276,7 +276,7 @@ static char *abbr(struct tm *tmp) /* Interpret the TZ envariable. */ -static void fgtzset_internal (int always, char* tz) +static void fgtzset_internal (int always, const char *tz) { time_t now; time(&now); diff --git a/src/Time/lowleveltime.h b/src/Time/lowleveltime.h index f2d48769b..9a2235c8c 100644 --- a/src/Time/lowleveltime.h +++ b/src/Time/lowleveltime.h @@ -39,11 +39,11 @@ void show (const char *zone, time_t t, int v); /* adapted from */ -struct tm * fgLocaltime (const time_t *t, char *tzName); +struct tm * fgLocaltime (const time_t *t, const char *tzName); /* Prototype for the internal function to get information based on TZ. */ extern struct tm *fgtz_convert (const time_t *t, int use_localtime, - struct tm *tp, char *tzName); + struct tm *tp, const char *tzName); /* This structure contains all the information about a timezone given in the POSIX standard TZ envariable. */