forked from Mirrors/arNetSked
Minor changes to get running in Python 3.13.
This commit is contained in:
15
arElement.py
15
arElement.py
@@ -18,8 +18,9 @@
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
import datetime as dt
|
||||
import pytz
|
||||
#import pytz
|
||||
from tzlocal import get_localzone
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
import threading
|
||||
|
||||
@@ -47,12 +48,18 @@ class arElement():
|
||||
self._arTz = v
|
||||
|
||||
def arGetLocalTime(self):
|
||||
ldt = self._arLtz.localize(dt.datetime.now())
|
||||
naive_dt = dt.datetime.now()
|
||||
#print(naive_dt)
|
||||
#aware_dt = naive_dt.replace(tzinfo=ZoneInfo('America/Chicago'))
|
||||
ldt = naive_dt.replace(tzinfo=self._arLtz)
|
||||
#ldt = self._arLtz.localize(dt.datetime.now())
|
||||
return ldt.astimezone(self._arTz)
|
||||
|
||||
def arGetUTCTime(self):
|
||||
ldt = self._arLtz.localize(dt.datetime.now())
|
||||
return ldt.astimezone(pytz.utc)
|
||||
#ldt = self._arLtz.localize(dt.datetime.now())
|
||||
naive_dt = dt.datetime.now()
|
||||
ldt = naive_dt.replace(tzinfo=self._arLtz)
|
||||
return ldt.astimezone("Etc/UTC")
|
||||
|
||||
def arPrint(self, message):
|
||||
self._arPrintLock.acquire()
|
||||
|
||||
Reference in New Issue
Block a user