From 9692611e9752bd8036ff2bad33704b862fbcfcc9 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 23 Apr 2025 20:08:24 +0200 Subject: common_gdal.py: Use OGR_TZFLAG_UTC rather than hardcoding its value 100. Cf. https://gdal.org/en/stable/api/vector_c_api.html#c.OGR_TZFLAG_UTC . --- common_gdal.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'common_gdal.py') diff --git a/common_gdal.py b/common_gdal.py index aa451ae..17ed1bc 100644 --- a/common_gdal.py +++ b/common_gdal.py @@ -159,10 +159,10 @@ def formatTZFlag(tzFlag : int) -> str: if tzFlag == ogr.TZFLAG_UTC: return 'UTC' - tzOffset = abs(tzFlag - 100) * 15 + tzOffset = abs(tzFlag - ogr.TZFLAG_UTC) * 15 tzHour = int(tzOffset / 60) tzMinute = int(tzOffset % 60) - tzSign = '+' if tzFlag > 100 else '-' + tzSign = '+' if tzFlag > ogr.TZFLAG_UTC else '-' return f'{tzSign}{tzHour:02}{tzMinute:02}' def fromGeomTypeName(name : str) -> int: @@ -346,7 +346,7 @@ def parseTimeZone(tz : str) -> int: raise BadConfiguration(f'Invalid timezone "{tz}"') tzFlag = tzHour*4 + int(tzMinute/15) if tzSign == '-': - tzFlag = 100 - tzFlag + tzFlag = ogr.TZFLAG_UTC - tzFlag else: - tzFlag += 100 + tzFlag += ogr.TZFLAG_UTC return tzFlag -- cgit v1.2.3