Changeset 1412


Ignore:
Timestamp:
17/08/06 11:56:24 (13 years ago)
Author:
domlowe
Message:

Oops wrong file committed: added exception to comparetimes to comapere times numerically if they are not standard internet times

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/parser/API/ops_AbstractFeature.py

    r1410 r1412  
    1111 
    1212def __compareTimes(timemin, timecheck, timemax): 
    13  
    14     year=int(timecheck.split('-')[0]) 
    15     month=int(timecheck.split('-')[1]) 
    16     day=int(timecheck.split('-')[2].split('T')[0]) 
    17     tcheck=cdtime.comptime(year,month,day) 
    18     timeok=0 
    19     if tcheck.cmp(timemin) >= 0: 
    20         if tcheck.cmp(timemax) < 1: 
    21             print tcheck 
    22             timeok = 1 
     13    try: 
     14        year=int(timecheck.split('-')[0]) 
     15        month=int(timecheck.split('-')[1]) 
     16        day=int(timecheck.split('-')[2].split('T')[0]) 
     17        tcheck=cdtime.comptime(year,month,day) 
     18        timeok=0 
     19        if tcheck.cmp(timemin) >= 0: 
     20            if tcheck.cmp(timemax) < 1: 
     21                print tcheck 
     22                timeok = 1 
     23    except: 
     24        #if it's not a proper internet time e.g. time = '6' then just compare numerically 
     25        timeok=0 
     26        if timecheck >=timemin: 
     27            if timecheck <=timemax: 
     28                print tcheck 
     29                timeok = 1 
    2330    return timeok 
    2431 
Note: See TracChangeset for help on using the changeset viewer.