?¡ëPNG
IHDR ? f ??C1 sRGB ??¨¦ gAMA ¡À?¨¹a pHYs ? ??o¡§d GIDATx^¨ª¨¹L¡±¡Âe¡ÂY?a?("Bh?_¨°???¡é¡ì?q5k?*:t0A-o??£¤]VkJ¡éM??f?¡À8\k2¨ªll¡ê1]q?¨´???T
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/user1137782/www/china1.by/classwithtostring.php on line 86
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 213
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 214
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 218
""" ODMG type classes for date/time handling
These are built on top of the basic DateTime[Delta] types and
include rudimentary time zone handling through an offset in
minutes. It is the applications responsibility to set the offset
to correct values. The offsets are then used in date calculations.
The implementation has not yet been thoroughly tested, but
provides a good example of the swiftness with which you can build
new date/time classes on top of the two basic types. If you find
any errors or would like to see new features, mail them to
mal@lemburg.com.
"""
__version__ = '0.1alpha'
__author__ = 'Marc-Andre Lemburg, mailto:mal@lemburg.com'
import DateTime
class _EmptyClass: pass
class Date:
offset = 0 # from some imaginary time zone in minutes
def __init__(self,*args):
self.data = apply(DateTime.DateTime,args)
def set_timezone(self,offset):
self.offset = offset
def __getattr__(self,what):
return getattr(self.data,what)
def __sub__(self,other):
if isinstance(other,Date):
if self.offset != other.offset:
# Be careful about different offsets:
d = (self.data - self.offset * DateTime.oneMinute) \
- (other.data - other.offset * DateTime.oneMinute)
else:
# Offsets are equal: no adjustment needed
d = self.data - other.data
o = _EmptyClass()
o.__class__ = Interval
o.data = d
return o
elif isinstance(other,Interval):
d = self.data - other.data
o = _EmptyClass()
o.__class__ = Date
o.data = d
o.offset = self.offset # inherit the offset
return o
else:
raise TypeError,"operation not supported"
def __add__(self,other):
if isinstance(other,Interval):
d = self.data + other.data
o = _EmptyClass()
o.__class__ = Date
o.data = d
o.offset = self.offset # inherit the offset
return o
else:
raise TypeError,"operation not supported"
def __str__(self):
return str(self.data)
def __repr__(self):
return '' % (str(self.data),id(self))
class Timestamp(Date):
def __repr__(self):
return '' % (str(self.data),id(self))
class Time:
def __init__(self,*args):
self.data = apply(DateTime.TimeDelta,args)
def __getattr__(self,what):
return getattr(self.data,what)
def __sub__(self,other):
if isinstance(other,Time):
d = self.data - other.data
o = _EmptyClass()
o.__class__ = Interval
o.data = d
return o
elif isinstance(other,Interval):
d = self.data - other.data
o = _EmptyClass()
o.__class__ = Time
o.data = d
return o
else:
raise TypeError,"operation not supported"
def __add__(self,other):
if isinstance(other,Time):
d = self.data + other.data
o = _EmptyClass()
o.__class__ = Interval
o.data = d
return o
elif isinstance(other,Interval):
d = self.data + other.data
o = _EmptyClass()
o.__class__ = Time
o.data = d
return o
else:
raise TypeError,"operation not supported"
def __str__(self):
return str(self.data)
def __repr__(self):
return '