Skip to content

Commit

Permalink
use calendar for UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Oct 17, 2017
1 parent 580ef41 commit f52d50e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion qpformat/file_formats/single_tif_phasics.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import calendar
import copy
import time
import xml.etree.ElementTree as ET
Expand Down Expand Up @@ -89,7 +90,8 @@ def get_time(self, idx=0):
structtime = time.strptime(timestr[0],
"%Y-%m-%d_%Hh%Mm%Ss")
fracsec = float(timestr[1]) * 1e-5
thetime = time.mktime(structtime) + fracsec
# use calendar, because we need UTC
thetime = calendar.timegm(structtime) + fracsec
else:
thetime = 0
return thetime
Expand Down
2 changes: 1 addition & 1 deletion tests/test_single_tif_phasics.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_load_data():
def test_data_content():
path = join(dirname(abspath(__file__)), "data/single_phasics.tif")
ds = qpformat.load_data(path)
assert ds.get_time() == 1461943895.00827
assert ds.get_time() == 1461951095.00827
qpi = ds.get_qpimage()
assert qpi.meta["wavelength"] == 550e-9
assert np.allclose(qpi.amp.max(), 188.57930365845519)
Expand Down

0 comments on commit f52d50e

Please sign in to comment.