Skip to content

Commit

Permalink
replace deprecated tz.localize() with datetime.replace() (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotan authored May 23, 2024
1 parent 61e9a96 commit b5b0b3e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2024-05-23 Jan Kotanski <jankotan@gmail.com>
* replace deprecated tz.localize() with datetime.replace() (#111)
* tagged as 3.21.1

2024-05-22 Jan Kotanski <jankotan@gmail.com>
* improve support for creating measurement files in appendentry mode (#108)
* change entryname in the appendentry mode to '%s_%05i' (#108)
Expand Down
2 changes: 1 addition & 1 deletion sardananxsrecorder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
""" Sardana Scan Recorders """

#: package version
__version__ = "3.21.0"
__version__ = "3.21.1"
6 changes: 5 additions & 1 deletion sardananxsrecorder/nxsrecorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import os
import re
import sys

import numpy
import json
Expand Down Expand Up @@ -1129,7 +1130,10 @@ def __timeToString(self, mtime, tzone):
tz = pytz.timezone(self.__timezone)

fmt = '%Y-%m-%dT%H:%M:%S.%f%z'
starttime = tz.localize(mtime)
if sys.version_info > (3, 6):
starttime = mtime.replace(tzinfo=tz)
else:
starttime = tz.localize(mtime)
return str(starttime.strftime(fmt))

def _endRecordList(self, recordlist):
Expand Down

0 comments on commit b5b0b3e

Please sign in to comment.