Mercurial > p > roundup > code
comparison roundup/date.py @ 971:5252cc77eaa0
typ0
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 23 Aug 2002 04:42:43 +0000 |
| parents | 832d1209aaa2 |
| children | 9b910e8d987d |
comparison
equal
deleted
inserted
replaced
| 970:6957938a3574 | 971:5252cc77eaa0 |
|---|---|
| 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.24 2002-08-21 07:07:27 richard Exp $ | 18 # $Id: date.py,v 1.25 2002-08-23 04:42:43 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 |
| 366 '[#d] [[[H]H:MM]:SS]') | 366 '[#d] [[[H]H:MM]:SS]') |
| 367 | 367 |
| 368 info = m.groupdict() | 368 info = m.groupdict() |
| 369 for group, attr in {'y':'year', 'm':'month', 'w':'week', 'd':'day', | 369 for group, attr in {'y':'year', 'm':'month', 'w':'week', 'd':'day', |
| 370 'H':'hour', 'M':'minute', 'S':'second'}.items(): | 370 'H':'hour', 'M':'minute', 'S':'second'}.items(): |
| 371 if info.getr(group, None) is not None: | 371 if info.get(group, None) is not None: |
| 372 setattr(self, attr, int(info[group])) | 372 setattr(self, attr, int(info[group])) |
| 373 | 373 |
| 374 if self.week: | 374 if self.week: |
| 375 self.day = self.day + self.week*7 | 375 self.day = self.day + self.week*7 |
| 376 | 376 |
| 459 if __name__ == '__main__': | 459 if __name__ == '__main__': |
| 460 test() | 460 test() |
| 461 | 461 |
| 462 # | 462 # |
| 463 # $Log: not supported by cvs2svn $ | 463 # $Log: not supported by cvs2svn $ |
| 464 # Revision 1.24 2002/08/21 07:07:27 richard | |
| 465 # In preparing to turn back on link/unlink journal events (by default these | |
| 466 # are turned off) I've: | |
| 467 # - fixed back_anydbm so it can journal those events again (had broken it | |
| 468 # with recent changes) | |
| 469 # - changed the serialisation format for dates and intervals to use a | |
| 470 # numbers-only (and sign for Intervals) string instead of tuple-of-ints. | |
| 471 # Much smaller. | |
| 472 # | |
| 464 # Revision 1.23 2002/07/18 23:07:08 richard | 473 # Revision 1.23 2002/07/18 23:07:08 richard |
| 465 # Unit tests and a few fixes. | 474 # Unit tests and a few fixes. |
| 466 # | 475 # |
| 467 # Revision 1.22 2002/07/14 06:05:50 richard | 476 # Revision 1.22 2002/07/14 06:05:50 richard |
| 468 # . fixed the date module so that Date(". - 2d") works | 477 # . fixed the date module so that Date(". - 2d") works |
