-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent behavior of timezone (nTZFlag) of DateTime fields among drivers #2696
Comments
Yes, I doubt any driver (except the Memory one) is able to encode the concept of 'localtime'.
Probably it was planned to be written, but I'm not aware of any existing further documentation regarding timezones. For GPKG, there has been a fix in 3.1. You'd now get
Yes, it doesn't. It currently completely ignores the timezone info at all. Should it convert into GMT when there's a timezone ? That'd be arguable... I'm not sure which semantics MapInfo itself attaches to datetimes. |
I'm not familiar enough with the MapInfo file format. As far as I can see it is not possible to find out if a driver supports timezones or not, except by testing it? I found another strange result for GPSTrackMaker:
Output:
|
No there's no metadata for that currently
OK, looking at the driver, it normalizes datetime to UTC taking into account the timezone information. The only real issue was with it dealing with TZFlag=1 (localtime) as it was a normal time zone. I've just fixed that (to ignore it, ie consider it as unknown/UTC) |
Is the UTC conversion done correctly?
while
Isn't unixTime in seconds and (TZFlag - 100) * 15 in minutes?
Sorry, I should have been more clear in what I meant. |
yes, that's that. In your above snippet, the timedela should be subtracted, not added (I believe...) |
I noticed that different drivers handle the nTZFlag of OGR_F_SetFieldDateTimeEx differently. I do not know the correct behavior of the drivers should be, thus everything could be as it should be expected!
The documentation of OGR_F_SetFieldDateTimeEx mentions 1=localtime, however, it seems as this is either converted to 0=unknown or 100=GMT. The documentation mentions also "see data model for details", but I'm unsure where to find this information (https://gdal.org/user/vector_data_model.html seems not to contain information regarding timezones).
The GPKG driver seems only to support GMT timezone and either convert to GMT for 0=unknown or fails.
The GPKG Specification mentions the following for DATETIME:
Mapinfo seems not to support timezone at all.
Gives the following output:
The text was updated successfully, but these errors were encountered: