Changeset 31819c5 in sasmodels


Ignore:
Timestamp:
Oct 31, 2014 5:17:43 PM (10 years ago)
Author:
pkienzle
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
216a9e1
Parents:
ba69383
Message:

python2.6 does not support timedelta.total_seconds()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/bumps_model.py

    rba69383 r31819c5  
    44import sys, os 
    55import datetime 
     6 
     7# CRUFT python 2.6 
     8if not hasattr(datetime.timedelta, 'total_seconds'): 
     9    def delay(dt): return dt.days*86400 + dt.seconds + 1e-6*dt.microseconds 
     10else: 
     11    def delay(dt): return dt.total_seconds() 
    612 
    713import numpy as np 
     
    3339    """ 
    3440    then = datetime.datetime.now() 
    35     return lambda: (datetime.datetime.now()-then).total_seconds() 
     41    return lambda: delay(datetime.datetime.now()-then) 
    3642 
    3743 
Note: See TracChangeset for help on using the changeset viewer.