On 05/02/2023 01:59, ypuntot wrote:
Then, given the time zone and the local time, you can know UTC.
If orgmode gets the UTC there is not ambiguity.

Mapping from local time to UTC may be ambiguous, so mapping from local time to time zone offset may be ambiguous as well.

The extreme case is 1892-07-04 that happened twice in Pacific/Apia due to offset change by 24 hours to another side of International Date Line. Due to the opposite transition there was no 2011-12-30 in this time zone.

Usual case is local time change due to daylight saving time. Notice that 2nd and 4th lines in the results table have the same input, but time offset differs by 1 hour in the output while local time is the same:

#+header: :var tz="Europe/Berlin"
#+header: :var t0='(:year 2023 :month 10 :day 29 :hour 2 :minute 30 :second 0)
#+header: :var hours='(1 2 3 2)
#+begin_src elisp
  (mapcar
   (lambda (h)
     (let ((dt (apply #'make-decoded-time :zone tz :dst -1 t0)))
       (setf (decoded-time-hour dt) h)
       (list dt
             (format-time-string "%F %a %T @%z" (encode-time dt) tz))))
   hours)
#+end_src

#+RESULTS:
| (0 30 1 29 10 2023 nil -1 Europe/Berlin) | 2023-10-29 Sun 01:30:00 @+0200 | | (0 30 2 29 10 2023 nil -1 Europe/Berlin) | 2023-10-29 Sun 02:30:00 @+0200 | | (0 30 3 29 10 2023 nil -1 Europe/Berlin) | 2023-10-29 Sun 03:30:00 @+0100 | | (0 30 2 29 10 2023 nil -1 Europe/Berlin) | 2023-10-29 Sun 02:30:00 @+0100 |

P.S.

https://zachholman.com/talk/utc-is-enough-for-everyone-right
https://www.youtube.com/watch?v=aEvB98CstOk
UTC is Enough for Everyone, Right?

Zach, whatever you do: just don't ever build a calendar



Reply via email to