1 | 4c4,21
|
---|
2 | < from datetime import timedelta, tzinfo
|
---|
3 | ---
|
---|
4 | > from datetime import timedelta as real_timedelta, tzinfo
|
---|
5 | >
|
---|
6 | > class timedelta :
|
---|
7 | > def __init__(self,*args,**kwargs) :
|
---|
8 | > self.__td = real_timedelta(*args,**kwargs)
|
---|
9 | > self.days = 0
|
---|
10 | >
|
---|
11 | > def __total_seconds(self) :
|
---|
12 | > return self.__td.days*24*3600 + self.__td.seconds
|
---|
13 | >
|
---|
14 | > seconds = property(fget=__total_seconds, doc= 'total seconds for time difference')
|
---|
15 | > def __getattr__(self, key) :
|
---|
16 | > if key in ['days','seconds'] :
|
---|
17 | > ret = getattr(self,key)
|
---|
18 | > else :
|
---|
19 | > ret = getattr(self.__td,key)
|
---|
20 | > return ret
|
---|
21 | >
|
---|