-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed negative timestamps parsing for windows #230
Conversation
…amps into datetimes.
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #230 +/- ##
==========================================
- Coverage 55.05% 54.95% -0.10%
==========================================
Files 23 23
Lines 3954 3963 +9
Branches 576 578 +2
==========================================
+ Hits 2177 2178 +1
- Misses 1641 1648 +7
- Partials 136 137 +1
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, also we should add windows to the GitHub testing matrix.
@@ -50,5 +50,8 @@ def test_decimal_year_epoch(self): | |||
test_year = decimal_year(epoch_time_to_utc_datetime(epoch)) | |||
self.assertAlmostEqual(year, test_year) | |||
|
|||
|
|||
|
|||
def test_negative_epoch(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Included test to check if negative timestamps are working properly.
epoch_time = epoch_time_milli / 1000 | ||
dt = datetime.datetime.fromtimestamp(epoch_time, datetime.timezone.utc) | ||
|
||
if os.name == "nt" and epoch_time < 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using Windows, check for negative timestamps, and handle it properly.
Added a bypass of time_utils for Windows OS users, which creates datetime objects from negative timestamps/epochs.
Type of change:
Please delete options that are not relevant.
Checklist: