Ignore:
Timestamp:
05/10/17 17:41:17 (7 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

The values are checked and the OK button is updated accordingly (re #307)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/flight.py

    r635 r846  
    4040
    4141    @staticmethod
     42    def getMinutesDifference(minutes1, minutes2):
     43        """Get the difference in minutes between the given two time
     44        instances."""
     45        diff1 = minutes1 - minutes2
     46        diff2 = -1 * diff1
     47
     48        if diff1 < 0: diff1 += 60*24
     49        else: diff2 += 60*24
     50
     51        diff = min(diff1, diff2)
     52
     53        return -1*diff if diff2<diff1 else diff
     54
     55    @staticmethod
    4256    def isTimeDifferenceTooMuch(scheduledTime, realTimestamp):
    4357        """Determine if the given real time differs to much from the scheduled
     
    5468        realMinute = realTime.tm_hour * 60 + realTime.tm_min
    5569
    56         diff1 = scheduledMinute - realMinute
    57         diff2 = -1 * diff1
    58 
    59         if diff1 < 0: diff1 += 60*24
    60         else: diff2 += 60*24
    61 
    62         diff = min(diff1, diff2)
     70        diff = abs(Flight.getMinutesDifference(scheduledMinute, realMinute))
    6371
    6472        return (diff>Flight.TIME_WARNING_DIFFERENCE,
Note: See TracChangeset for help on using the changeset viewer.