Mercurial > p > roundup > code
comparison roundup/date.py @ 1337:95ef1dcbb3be
always default time to 00:00:00
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 16 Dec 2002 04:39:36 +0000 |
| parents | 46a1951fdb14 |
| children | 82ff15307f92 |
comparison
equal
deleted
inserted
replaced
| 1336:6a54b51b1784 | 1337:95ef1dcbb3be |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: date.py,v 1.37 2002-12-09 02:43:21 richard Exp $ | 18 # $Id: date.py,v 1.38 2002-12-16 04:39:36 richard Exp $ |
| 19 | 19 |
| 20 __doc__ = """ | 20 __doc__ = """ |
| 21 Date, time and time interval handling. | 21 Date, time and time interval handling. |
| 22 """ | 22 """ |
| 23 | 23 |
| 242 raise ValueError, _('Not a date spec: [[yyyy-]mm-dd].' | 242 raise ValueError, _('Not a date spec: [[yyyy-]mm-dd].' |
| 243 '[[h]h:mm[:ss]][offset]') | 243 '[[h]h:mm[:ss]][offset]') |
| 244 | 244 |
| 245 info = m.groupdict() | 245 info = m.groupdict() |
| 246 | 246 |
| 247 # get the current date/time using the offset | 247 # get the current date as our default |
| 248 y,m,d,H,M,S,x,x,x = time.gmtime(time.time()) | 248 y,m,d = time.gmtime(time.time())[:3] |
| 249 | |
| 250 # time defaults to 00:00:00 _always_ | |
| 251 H = M = S = 0 | |
| 249 | 252 |
| 250 # override year, month, day parts | 253 # override year, month, day parts |
| 251 if info['m'] is not None and info['d'] is not None: | 254 if info['m'] is not None and info['d'] is not None: |
| 252 m = int(info['m']) | 255 m = int(info['m']) |
| 253 d = int(info['d']) | 256 d = int(info['d']) |
| 254 if info['y'] is not None: y = int(info['y']) | 257 if info['y'] is not None: |
| 255 H = M = S = 0 | 258 y = int(info['y']) |
| 256 | 259 |
| 257 # override hour, minute, second parts | 260 # override hour, minute, second parts |
| 258 if info['H'] is not None and info['M'] is not None: | 261 if info['H'] is not None and info['M'] is not None: |
| 259 H = int(info['H']) - offset | 262 H = int(info['H']) - offset |
| 260 M = int(info['M']) | 263 M = int(info['M']) |
