[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] org-test: Fix zone-dependent miscalculation of days of week
From: |
Kyle Meyer |
Subject: |
Re: [PATCH] org-test: Fix zone-dependent miscalculation of days of week |
Date: |
Mon, 03 Jun 2024 21:45:00 -0400 |
[ Sorry, I somehow managed to drop the References and In-Reply-to
headers from my previous reply. I'll include that message again here
along with some examples. ]
Ihor Radchenko writes:
> I suspect that the failures are because of your timezone.
Yes, that matches my conclusion too and was what I was trying to convey
in the commit message.
> If my guess is right, there will always be some timezone where a given
> number seconds from epoch is a different day...
> I am not sure how to address this problem.
How about my patch? Notice that format-time-string is invoked with ZONE
set to t so that TIME is always taken as UTC.
Examples
--------
;;; locale en_US.UTF-8
;; local time zone (Japan in this demo)
(format-time-string "%A %T %z" 259200) => "Sunday 09:00:00 +0900"
;; force UTC
(format-time-string "%A %T %z" 259200 t) => "Sunday 00:00:00 +0000"
;; locale de_BE.UTF-8
;; local time zone
(format-time-string "%A %T %z" 259200) => "Sonntag 09:00:00 +0900"
;; force UTC
(format-time-string "%A %T %z" 259200 t) => "Sonntag 00:00:00 +0000"