summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c0a4662)
raw | patch | inline | side by side (parent: c0a4662)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 25 Jul 2001 04:09:34 +0000 (04:09 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 25 Jul 2001 04:09:34 +0000 (04:09 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@80 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/date.py | patch | blob | history |
diff --git a/roundup/date.py b/roundup/date.py
index d66c17479586b860acc9b04b893edb5b045b01b1..d6feb4f260e66b3c92805af2918275064fa6d09c 100644 (file)
--- a/roundup/date.py
+++ b/roundup/date.py
-# $Id: date.py,v 1.3 2001-07-23 07:56:05 richard Exp $
+# $Id: date.py,v 1.4 2001-07-25 04:09:34 richard Exp $
import time, re, calendar
if type(spec) == type(''):
self.set(spec, offset=offset)
else:
+ y,m,d,H,M,S,x,x,x = spec
+ ts = calendar.timegm((y,m,d,H+offset,M,S,0,0,0))
self.year, self.month, self.day, self.hour, self.minute, \
- self.second, x, x, x = spec
- self.offset = offset
+ self.second, x, x, x = time.gmtime(ts)
def applyInterval(self, interval):
''' Apply the interval to this date
def __str__(self):
"""Return this date as a string in the yyyy-mm-dd.hh:mm:ss format."""
- return time.strftime('%Y-%m-%d.%T', (self.year, self.month,
- self.day, self.hour, self.minute, self.second, 0, 0, 0))
+ return time.strftime('%Y-%m-%d.%T', (self.year, self.month, self.day,
+ self.hour, self.minute, self.second, 0, 0, 0))
def pretty(self):
''' print up the date date using a pretty format...
info = m.groupdict()
# get the current date/time using the offset
- y,m,d,H,M,S,x,x,x = time.gmtime(time.time())
- ts = calendar.timegm((y,m,d,H+offset,M,S,0,0,0))
- self.year, self.month, self.day, self.hour, self.minute, \
- self.second, x, x, x = time.gmtime(ts)
+ y,m,d,H,M,S,x,x,x = time.gmtime()
+ # override year, month, day parts
if info['m'] is not None and info['d'] is not None:
- self.month = int(info['m'])
- self.day = int(info['d'])
- if info['y'] is not None:
- self.year = int(info['y'])
- self.hour = self.minute = self.second = 0
+ m = int(info['m'])
+ d = int(info['d'])
+ if info['y'] is not None: y = int(info['y'])
+ H = M = S = 0
+ # override hour, minute, second parts
if info['H'] is not None and info['M'] is not None:
- self.hour = int(info['H'])
- self.minute = int(info['M'])
- if info['S'] is not None:
- self.second = int(info['S'])
+ H = int(info['H']) - offset
+ M = int(info['M'])
+ S = 0
+ if info['S'] is not None: S = int(info['S'])
+
+ # now handle the adjustment of hour
+ ts = calendar.timegm((y,m,d,H,M,S,0,0,0))
+ self.year, self.month, self.day, self.hour, self.minute, \
+ self.second, x, x, x = time.gmtime(ts)
if info['o']:
self.applyInterval(Interval(info['o']))
#
# $Log: not supported by cvs2svn $
+# Revision 1.3 2001/07/23 07:56:05 richard
+# Storing only marshallable data in the db - no nasty pickled class references.
+#
# Revision 1.2 2001/07/22 12:09:32 richard
# Final commit of Grande Splite
#