Changeset 1410


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

Random non-internet times cannot be converted to CDtimes so added exception to return original time to getCDtime method

File:
1 edited

Legend:

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

    r1086 r1410  
    2424 
    2525def __getCDtime(time): 
    26     year=int(time.split('-')[0]) 
    27     month=int(time.split('-')[1]) 
    28     day=int(time.split('-')[2].split('T')[0]) 
    29     cdTimeVal=cdtime.comptime(year,month,day) 
     26    try: 
     27        year=int(time.split('-')[0]) 
     28        month=int(time.split('-')[1]) 
     29        day=int(time.split('-')[2].split('T')[0]) 
     30        cdTimeVal=cdtime.comptime(year,month,day) 
     31    except: 
     32        #if it's not a proper internet time e.g. time = '6' then return the original time back. 
     33        return time 
    3034    return cdTimeVal 
Note: See TracChangeset for help on using the changeset viewer.