diff --git a/neon_utils/location_utils.py b/neon_utils/location_utils.py index 96ac6e88..2c99580e 100644 --- a/neon_utils/location_utils.py +++ b/neon_utils/location_utils.py @@ -26,10 +26,11 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import pendulum +import pytz from datetime import datetime from typing import Optional, Union + from dateutil.tz import tzlocal from timezonefinder import TimezoneFinder from re import sub @@ -143,10 +144,10 @@ def get_timezone(lat, lng) -> (str, float): Note that some coordinates do not have a city, but may have a county. :param lat: latitude :param lng: longitude - :return: timezone name, offset from GMT + :return: timezone name, offset in hours from UTC """ timezone = TimezoneFinder().timezone_at(lng=float(lng), lat=float(lat)) - offset = pendulum.from_timestamp(0, timezone).offset_hours + offset = pytz.timezone(timezone).utcoffset(datetime.utcnow()).seconds / 3600.0 return timezone, offset diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 69d4432c..0082c8f2 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,6 +1,6 @@ ovos-bus-client~=0.0.3 combo-lock~=0.2 -pendulum~=2.1 +pytz>=2022.1 timezonefinder~=5.2 nltk~=3.5 pyyaml>=5.4,<7.0