Unidata / UDUNITS-2

API and utility for arithmetic manipulation of units of physical quantities
http://www.unidata.ucar.edu/software/udunits
Other
62 stars 36 forks source link

How does one do time+timezone conversions? #53

Closed drf5n closed 6 years ago

drf5n commented 6 years ago

udunits2 seems to parse and understand timezones:

$ udunits2 -H 'second since 1970-01-01 00:00:00 -1:00' -W 'second since 1970-01-01 00:00:00 -0'
    1 second since 1970-01-01 00:00:00 -1:00 = 3601 (second since 1970-01-01 00:00:00 -0)
    x/(second since 1970-01-01 00:00:00 -0) = (x/(second since 1970-01-01 00:00:00 -1:00)) + 3600

but it is unclear how to convert values using timezones:

$ udunits2 -H '86400 second since 1970-01-01 00:00:00 -1:00' -W 'second since 1970-01-01 00:00:00 -0'
udunits2: Units are not convertible
$ 

Is it possible? How?

semmerson commented 6 years ago

The problem was due to a bug in udunits2(1). It should be fixed in the latest release (2.2.26).