times
Advanced tools
+2
-1
| Metadata-Version: 1.0 | ||
| Name: times | ||
| Version: 0.6 | ||
| Version: 0.6.1 | ||
| Summary: Times is a small, minimalistic, Python library for dealing with time conversions between universal time and arbitrary timezones. | ||
@@ -37,2 +37,3 @@ Home-page: https://github.com/nvie/times/ | ||
| Classifier: Programming Language :: Python :: 2 | ||
| Classifier: Programming Language :: Python :: 2.6 | ||
| Classifier: Programming Language :: Python :: 2.7 | ||
@@ -39,0 +40,0 @@ Classifier: Programming Language :: Python :: 3.2 |
+30
-16
@@ -42,4 +42,6 @@ Times | ||
| >>> times.to_universal(local_time, 'Europe/Amsterdam') | ||
| datetime.datetime(2012, 2, 1, 10, 31, 45, 781262) | ||
| ```pycon | ||
| >>> times.to_universal(local_time, 'Europe/Amsterdam') | ||
| datetime.datetime(2012, 2, 1, 10, 31, 45, 781262) | ||
| ``` | ||
@@ -60,4 +62,6 @@ The second argument can be a `pytz.timezone` instance, or a timezone string. | ||
| >>> import time, times | ||
| >>> print times.to_universal('2012-02-03 11:59:03-0500') # auto-detects source timezone | ||
| ```pycon | ||
| >>> import time, times | ||
| >>> print times.to_universal('2012-02-03 11:59:03-0500') # auto-detects source timezone | ||
| ``` | ||
@@ -71,3 +75,5 @@ `Times` utilizes the string parsing routines available in [dateutil][3]. Note | ||
| >>> print times.to_universal('2012-02-03 11:59:03', 'Europe/Amsterdam') | ||
| ```pycon | ||
| >>> print times.to_universal('2012-02-03 11:59:03', 'Europe/Amsterdam') | ||
| ``` | ||
@@ -82,5 +88,7 @@ This is the inverse of `times.format()`. | ||
| >>> import time, times | ||
| >>> print times.to_universal(time.time()) | ||
| 2012-02-03 11:59:03.588419 | ||
| ```pycon | ||
| >>> import time, times | ||
| >>> print times.to_universal(time.time()) | ||
| 2012-02-03 11:59:03.588419 | ||
| ``` | ||
@@ -91,3 +99,5 @@ Note that `to_universal` auto-detects that you give it a UNIX timestamp. | ||
| >>> print times.to_unix(universal_time) | ||
| ```pycon | ||
| >>> print times.to_unix(universal_time) | ||
| ``` | ||
@@ -100,5 +110,7 @@ | ||
| >>> import times | ||
| >>> print times.now() | ||
| datetime.datetime(2012, 2, 1, 11, 51, 27, 621491) | ||
| ```pycon | ||
| >>> import times | ||
| >>> print times.now() | ||
| datetime.datetime(2012, 2, 1, 11, 51, 27, 621491) | ||
| ``` | ||
@@ -112,6 +124,8 @@ | ||
| >>> import times | ||
| >>> now = times.now() | ||
| >>> print times.format(now, 'CET') | ||
| 2012-02-01 21:32:10+0100 | ||
| ```pycon | ||
| >>> import times | ||
| >>> now = times.now() | ||
| >>> print times.format(now, 'CET') | ||
| 2012-02-01 21:32:10+0100 | ||
| ``` | ||
@@ -118,0 +132,0 @@ As with the `to_universal` function, the second argument may be either |
+1
-0
@@ -65,2 +65,3 @@ import sys | ||
| 'Programming Language :: Python :: 2', | ||
| 'Programming Language :: Python :: 2.6', | ||
| 'Programming Language :: Python :: 2.7', | ||
@@ -67,0 +68,0 @@ 'Programming Language :: Python :: 3.2', |
| Metadata-Version: 1.0 | ||
| Name: times | ||
| Version: 0.6 | ||
| Version: 0.6.1 | ||
| Summary: Times is a small, minimalistic, Python library for dealing with time conversions between universal time and arbitrary timezones. | ||
@@ -37,2 +37,3 @@ Home-page: https://github.com/nvie/times/ | ||
| Classifier: Programming Language :: Python :: 2 | ||
| Classifier: Programming Language :: Python :: 2.6 | ||
| Classifier: Programming Language :: Python :: 2.7 | ||
@@ -39,0 +40,0 @@ Classifier: Programming Language :: Python :: 3.2 |
@@ -39,3 +39,3 @@ import sys | ||
| if not isinstance(local_dt, datetime.datetime): | ||
| raise ValueError('First argument should be int, float or datetime.') | ||
| raise TypeError('Expected a datetime object') | ||
@@ -67,5 +67,3 @@ if timezone is not None: | ||
| if not isinstance(ut, (int, float)): | ||
| raise ValueError( | ||
| 'First argument to from_unix should be an int or float' | ||
| ) | ||
| raise TypeError('Expected an int or float value') | ||
@@ -90,5 +88,3 @@ return datetime.datetime.utcfromtimestamp(float(ut)) | ||
| if not isinstance(dt, datetime.datetime): | ||
| raise ValueError( | ||
| 'First argument to to_unix should be a datetime object' | ||
| ) | ||
| raise TypeError('Expected a datetime object') | ||
@@ -95,0 +91,0 @@ return calendar.timegm(dt.utctimetuple()) |
+1
-1
@@ -1,1 +0,1 @@ | ||
| VERSION = '0.6' | ||
| VERSION = '0.6.1' |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
14283
0.44%155
-1.9%