[Bug 868395] Re: Bug in Europe/Russia timezones
Dmitry Nesterov
868395 at bugs.launchpad.net
Mon Mar 21 20:59:22 UTC 2016
2016b. Long live to the bug!
Buggy:
$ dpkg -l | grep tzdata
ii tzdata 2016b-0ubuntu0.12.04 time zone and daylight-saving time data
ii tzdata-java 2016b-0ubuntu0.12.04 time zone and daylight-saving time data for use by java runtimes
$ cat ./bug.c
#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;
}
$ gcc ./bug.c
$ time ./a.out
Mon Mar 21 23:56:11 2016
real 0m4.607s
user 0m4.599s
sys 0m0.002s
$
Patched:
$ dpkg -l | grep tzdata
ii tzdata 2016b-0ubuntu0.12.04-yandex1 time zone and daylight-saving time data
ii tzdata-java 2016b-0ubuntu0.12.04-yandex1 time zone and daylight-saving time data for use by java runtimes
$ cat ./bug.c
#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;
}
$ gcc ./bug.c
$ time ./a.out
Mon Mar 21 23:58:19 2016
real 0m1.296s
user 0m1.292s
sys 0m0.002s
$
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to tzdata in Ubuntu.
https://bugs.launchpad.net/bugs/868395
Title:
Bug in Europe/Russia timezones
Status in tzdata package in Ubuntu:
Confirmed
Bug description:
In version tzdata-2011j (tzdata-2011k also affected) was founded strange bug in russian timezones.
Because of a law "On the Calculation of Time" there were changes in zone like:
3:00 Russia MSK/MSD 2011
changed to:
3:00 Russia MSK/MSD 2011 Mar 27 2:00s
4:00 - MSK
But if no rule used for this change (using "-" instead of rule "Russia"), calling of system function localtime_r() takes more time (takes more than 40% time longer).
I used following code for measuring:
==============================
#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;
}
==============================
and also this sql code in mysql db:
select benchmark(1000000, from_unixtime(1317044847));
For example, when I'm using new tzdata-2011j results are:
1. time ./a.out (c code)
real 0m5.165s
user 0m5.140s
sys 0m0.000s
2. sql query
mysql> select benchmark(1000000, from_unixtime(1317044847));
+-----------------------------------------------+
| benchmark(1000000, from_unixtime(1317044847)) |
+-----------------------------------------------+
| 0 |
+-----------------------------------------------+
1 row in set (1.03 sec).
And when I'm using old tzdata-2008b:
1. time ./a.out (c code)
real 0m1.675s
user 0m1.450s
sys 0m0.000s
2. sql query
mysql> select benchmark(1000000, from_unixtime(1317044847));
+-----------------------------------------------+
| benchmark(1000000, from_unixtime(1317044847)) |
+-----------------------------------------------+
| 0 |
+-----------------------------------------------+
1 row in set (0.65 sec)
This bug seemed critical on high loaded systems (for example, for
databases that using unix timestamps).
My configuration was:
Description: Ubuntu 8.04.1
Release: 8.04
Packages: 2011j~repack-0ubuntu0.8.04 and 2008b-1ubuntu1
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/tzdata/+bug/868395/+subscriptions
More information about the foundations-bugs
mailing list