Skip to content

Commit

Permalink
Corrected for time zone
Browse files Browse the repository at this point in the history
  • Loading branch information
jdh4 committed Oct 30, 2024
1 parent 169f329 commit f68d829
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_output_formatters.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import time
from jobstats import Jobstats
from output_formatters import ClassicOutput
import pytest
Expand Down Expand Up @@ -41,9 +42,15 @@ def test_human_seconds(simple_stats):
def test_human_datetime(simple_stats):
formatter = ClassicOutput(simple_stats)
secs_since_epoch = 1730298181
# shift to Eastern Time Zone (-0400)
hours = int(time.strftime("%z")) / 100 + 4
secs_since_epoch += hours * 60 * 60
expected = "Wed Oct 30, 2024 at 10:23 AM"
assert formatter.human_datetime(secs_since_epoch) == expected
secs_since_epoch = 1730298181 - 29 * 24 * 60 * 60 + 12 * 60 * 60
# shift to EDT (-0400)
hours = int(time.strftime("%z")) / 100 + 4
secs_since_epoch += hours * 60 * 60
expected = "Tue Oct 1, 2024 at 10:23 PM"
assert formatter.human_datetime(secs_since_epoch) == expected

Expand Down

0 comments on commit f68d829

Please sign in to comment.