This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Incorrect timezone offset with current Russian rules - tzdata or glibc bug or normal?


I hit strange problem which looks like a bug and actually caused
serious problem due to different interpretation of current timezone
offset.

Current tzdata correctly - as far as I can tell - defines time today as
UTC-4 with summer time inactive:

/etc/localtime  Sat Mar 26 23:00:00 2011 UT = Sun Mar 27 03:00:00 2011 MSK isdst=0 gmtoff=14400
/etc/localtime  Sat Oct 25 21:59:59 2014 UT = Sun Oct 26 01:59:59 2014 MSK isdst=0 gmtoff=14400
/etc/localtime  Sat Oct 25 22:00:00 2014 UT = Sun Oct 26 01:00:00 2014 MSK isdst=0 gmtoff=10800
/etc/localtime  9223372036854689407 = NULL
/etc/localtime  9223372036854775807 = NULL


But the valule of variable "timezone" (man timezone(3)) is set to
UTC-3 ...

bor@opensuse:~/tmp/sapttzz> ./sapttz 
Name of local time zone:
   no info (=TZ)

Technical description of local time zone:
   UTC time +10800 sec

Daylight Saving Time at the current/given date is:
   inaktiv



where offset is computed as simply

    printf("   UTC time %+ld sec\n",- (long int)timezone);
    if(tm->tm_isdst == 1)
      printf("   aktiv\n");
    else if(tm->tm_isdst == 0)
      printf("   inaktiv\n");
    else
      printf("   unknown\n");

So basically any application which tries to compute current offset from
UTC as based offset (timezone) + dst offset (if isdst) will fail. Or
better, two programs running on the same system may have different idea
of current time.

What puzzles me - if I take previous timezone before last change
(before 2014f) the same program displays correct time. But visually
nothing has changed ...

/etc/localtime  Sat Mar 26 22:59:59 2011 UT = Sun Mar 27 01:59:59 2011 MSK isdst=0 gmtoff=10800
/etc/localtime  Sat Mar 26 23:00:00 2011 UT = Sun Mar 27 03:00:00 2011 MSK isdst=0 gmtoff=14400
/etc/localtime  9223372036854689407 = NULL
/etc/localtime  9223372036854775807 = NULL

bor@opensuse:~/tmp/sapttzz> ./sapttz 
Name of local time zone:
   no info (=TZ)

Technical description of local time zone:
   UTC time +14400 sec

Daylight Saving Time at the current/given date is:
   inaktiv


openSUSE 13.1 with glibc-2.18-4.21.1.x86_64

Any ideas?

TIA

-andrei


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]