Mercurial > p > roundup > code
comparison roundup/date.py @ 3823:7cda5b4daa91
fix a deprecation warning if usecs passed to datetime constructor is a float.
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Fri, 09 Mar 2007 14:54:39 +0000 |
| parents | 2a60b68985db |
| children | f5bb1ad47268 |
comparison
equal
deleted
inserted
replaced
| 3822:2a60b68985db | 3823:7cda5b4daa91 |
|---|---|
| 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.90 2007-03-09 10:25:09 schlatterbeck Exp $ | 18 # $Id: date.py,v 1.91 2007-03-09 14:54:39 schlatterbeck Exp $ |
| 19 | 19 |
| 20 """Date, time and time interval handling. | 20 """Date, time and time interval handling. |
| 21 """ | 21 """ |
| 22 __docformat__ = 'restructuredtext' | 22 __docformat__ = 'restructuredtext' |
| 23 | 23 |
| 496 Note that if the day is zero, and the day appears first in the | 496 Note that if the day is zero, and the day appears first in the |
| 497 format, then the day number will be removed from output. | 497 format, then the day number will be removed from output. |
| 498 ''' | 498 ''' |
| 499 dt = datetime.datetime(self.year, self.month, self.day, self.hour, | 499 dt = datetime.datetime(self.year, self.month, self.day, self.hour, |
| 500 self.minute, int(self.second), | 500 self.minute, int(self.second), |
| 501 (self.second - int (self.second)) * 1000000.) | 501 int ((self.second - int (self.second)) * 1000000.)) |
| 502 str = dt.strftime(format) | 502 str = dt.strftime(format) |
| 503 | 503 |
| 504 # handle zero day by removing it | 504 # handle zero day by removing it |
| 505 if format.startswith('%d') and str[0] == '0': | 505 if format.startswith('%d') and str[0] == '0': |
| 506 return ' ' + str[1:] | 506 return ' ' + str[1:] |
