Changeset 1054:a8ec882a1f9d


Ignore:
Timestamp:
04/24/22 13:07:12 (3 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

Fix to handle the time going backwards in X-Plane

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/xplane.py

    r1052 r1054  
    946946        if self._lastZuluSeconds is not None and \
    947947           zuluSeconds<self._lastZuluSeconds:
    948             print("xplane.Simulator._getTimestamp: Zulu seconds have gone backwards (%f -> %f), increasing day offset" % \
    949               (self._lastZuluSeconds, zuluSeconds))
    950             self._timestampDaysOffset += 1
     948            diff = self._lastZuluSeconds - zuluSeconds
     949            print("xplane.Simulator._getTimestamp: Zulu seconds have gone backwards: %f -> %f, diff: %f" % \
     950                  (self._lastZuluSeconds, zuluSeconds, diff))
     951            if diff>23*60*60:
     952                self._timestampDaysOffset += 1
     953            else:
     954                zuluSeconds = self._lastZuluSeconds
    951955
    952956        self._lastZuluSeconds = zuluSeconds
Note: See TracChangeset for help on using the changeset viewer.