[tz] localtime_r multiple times slower for Europe/Moscow timezone

Walt Mankowski waltman at pobox.com
Tue Jan 10 23:43:55 UTC 2023


Interesting! I can confirm that I also see this in Ubuntu
22.10. However, I do NOT see it on macOS 13.1.

Walt

On Wed, Jan 11, 2023 at 12:15:53AM +0100, Benjamin Drung via tz wrote:
> Hi,
> 
> a Ubuntu user has been reporting in https://launchpad.net/bugs/868395
> that the Europe/Moscow timezone is multiple times slower than other
> timezones. Here is the example bug.c code:
> 
> ```
> #include <time.h>
> #include <stdio.h>
> 
> int main() {
>   time_t t = time(0);
>   int i;
>   struct tm result;
>   for(i=0; i < 10000000; i++)
>     localtime_r(&t, &result);
>   puts(ctime(&t));
>   return 0;
> }
> ```
> 
> Compile and run this code:
> 
> ```
> gcc -o bug bug.c
> time TZ=Etc/UTC ./bug
> time TZ=Europe/Berlin ./bug
> time TZ=Europe/Moscow ./bug
> ```
> 
> The result on my machine is that Etc/UTC, Europe/Berlin, and other
> timezones take around 250 to 400 ms, but Europe/Moscow takes 1200 ms.
> The result is the same when running in a Debian unstable, Ubuntu 22.04
> (jammy) and Ubuntu 23.04 (lunar) chroot.
> 
> Is that a bug? If yes, is that a bug in glibc?
> 
> -- 
> Benjamin Drung
> Debian & Ubuntu Developer



More information about the tz mailing list