aboutsummaryrefslogtreecommitdiffstats
path: root/common_gdal.py
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2025-04-23 20:08:24 +0200
committerGuilhem Moulin <guilhem@fripost.org>2025-04-23 20:08:41 +0200
commit9692611e9752bd8036ff2bad33704b862fbcfcc9 (patch)
treeaac63169bae22ed23e72876c627c80fbb900d938 /common_gdal.py
parent990978c7403ca58956c131dc7992ff113ea04ea6 (diff)
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 .
Diffstat (limited to 'common_gdal.py')
-rw-r--r--common_gdal.py8
1 files changed, 4 insertions, 4 deletions
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