]> git.mxchange.org Git - flightgear.git/commitdiff
We had unified some of the platform disparate time handling code, and
authorcurt <curt>
Thu, 9 Apr 1998 18:40:13 +0000 (18:40 +0000)
committercurt <curt>
Thu, 9 Apr 1998 18:40:13 +0000 (18:40 +0000)
there was a bug in timesum() which calculated a new time stamp based on
the current time stamp + offset.  This hosed the periodic event processing
logic because you'd never arrive at the time the event was scheduled for.
Sky updates and lighting changes are handled via this event mechanism so
they never changed ... it is fixed now.

Time/event.c
Time/fg_time.c

index 89d22026e06949fd8529228aea9ab42d4c63ab28..5bb7882462d9a306cce7a505af77ab7845fd134d 100644 (file)
@@ -274,12 +274,17 @@ void fgEventProcess( void ) {
     /* get the current time */
     timestamp(&current);
 
+    fgPrintf(FG_EVENT, FG_DEBUG, "  Current timestamp = %ld\n", current.seconds);
+
     /* printf("Checking if anything is ready to move to the run queue\n"); */
 
     /* see if anything else is ready to be placed on the run queue */
     for ( i = 0; i < event_ptr; i++ ) {
        if ( events[i].status == FG_EVENT_READY ) {
-           if ( 0 > timediff(&current,&(events[i].next_run)) ) {
+           fgPrintf(FG_EVENT, FG_DEBUG, 
+                    "  Item %d, current %d, next run @ %ld\n", 
+                    i, current.seconds, events[i].next_run.seconds);
+           if ( timediff(&current, &(events[i].next_run)) <= 0) {
                addq(i);
            }
        }
@@ -296,10 +301,18 @@ void fgEventProcess( void ) {
 
 
 /* $Log$
-/* Revision 1.11  1998/04/03 22:12:55  curt
-/* Converting to Gnu autoconf system.
-/* Centralized time handling differences.
+/* Revision 1.12  1998/04/09 18:40:13  curt
+/* We had unified some of the platform disparate time handling code, and
+/* there was a bug in timesum() which calculated a new time stamp based on
+/* the current time stamp + offset.  This hosed the periodic event processing
+/* logic because you'd never arrive at the time the event was scheduled for.
+/* Sky updates and lighting changes are handled via this event mechanism so
+/* they never changed ... it is fixed now.
 /*
+ * Revision 1.11  1998/04/03 22:12:55  curt
+ * Converting to Gnu autoconf system.
+ * Centralized time handling differences.
+ *
  * Revision 1.10  1998/03/14 00:28:34  curt
  * replaced a printf() with an fgPrintf().
  *
index f6d2e5bdac79fb0b1090c4037b85137c6177a11d..20441a8189b46b69285bfc8edd146ea5d516d32e 100644 (file)
@@ -100,13 +100,9 @@ long timediff(fg_timestamp *first, fg_timestamp *last) {
 
 /* Return new timestamp given a time stamp and an interval to add in */
 void timesum(fg_timestamp *res, fg_timestamp *start, long millis) {
-    res->millis = start->millis + millis;
-    if (1000 < res->millis) {
-       res->seconds = start->millis + 1;
-       res->millis -= 1000;
-    } else {
-       res->seconds = start->millis;
-    }
+    res->seconds = start->seconds + 
+       ( start->millis + millis ) / 1000;
+    res->millis = ( start->millis + millis ) % 1000;
 }
 
 
@@ -372,9 +368,17 @@ void fgTimeUpdate(fgFLIGHT *f, struct fgTIME *t) {
 
 
 /* $Log$
-/* Revision 1.38  1998/04/08 23:35:40  curt
-/* Tweaks to Gnu automake/autoconf system.
+/* Revision 1.39  1998/04/09 18:40:14  curt
+/* We had unified some of the platform disparate time handling code, and
+/* there was a bug in timesum() which calculated a new time stamp based on
+/* the current time stamp + offset.  This hosed the periodic event processing
+/* logic because you'd never arrive at the time the event was scheduled for.
+/* Sky updates and lighting changes are handled via this event mechanism so
+/* they never changed ... it is fixed now.
 /*
+ * Revision 1.38  1998/04/08 23:35:40  curt
+ * Tweaks to Gnu automake/autoconf system.
+ *
  * Revision 1.37  1998/04/03 22:12:55  curt
  * Converting to Gnu autoconf system.
  * Centralized time handling differences.