-
Notifications
You must be signed in to change notification settings - Fork 948
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
schedule: make datetime objs timezone-aware and UTC default
* fix mock now() and tests with a timezone * allow flake8-max-line-length to be 90 * fixes for lack of datetime.timezone in python 2.7 (simple UTC) Signed-off-by: Steve Arnold <nerdboy@gentoo.org>
- Loading branch information
Showing
4 changed files
with
48 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import datetime | ||
|
||
|
||
class UTC(datetime.tzinfo): | ||
"""tzinfo derived concrete class named "UTC" with offset of 0""" | ||
# can be configured here | ||
_offset = datetime.timedelta(seconds=0) | ||
_dst = datetime.timedelta(0) | ||
_name = "UTC" | ||
|
||
def utcoffset(self, dt): | ||
return self.__class__._offset | ||
|
||
def dst(self, dt): | ||
return self.__class__._dst | ||
|
||
def tzname(self, dt): | ||
return self.__class__._name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters