Bug#652808: libglib2.0-0: glib fails to detect default timezone

Marcus Comstedt marcus.comstedt at 27m.se
Tue Dec 20 15:27:04 UTC 2011


Package: libglib2.0-0
Version: 2.30.2-4
Severity: normal

Dear Maintainer,

glib is unable to detect the correct timezone on my Debian system,
which is configured to CET using /etc/localtime ($TZ is not set).

Running the following test program:

--8<--
#include <stdio.h>
#include <time.h>
#include <glib.h>

int main()
{
  GDateTime * gdt  = g_date_time_new_now_local();
  printf("glib: %s\n", g_date_time_format(gdt, "%R %Z"));

  char buf[256];
  time_t now = time(0);
  struct tm *tm = localtime(&now);
  strftime(buf, sizeof(buf), "%R %Z", tm);
  printf("libc: %s\n", buf);
  
  return 0;
}
--8<--

produces the output

--8<--
glib: 15:17 UTC
libc: 16:17 CET
--8<--

I would have expected g_date_time_new_now_local() to also produce the
correct local time (CET).

The problem carries over to gnome_wall_clock in libgnome-desktop, and
therefore gnome-screensaver, which is where I noticed the issue.


  // Marcus


-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.1.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=sv_SE.ISO-8859-1 (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages libglib2.0-0 depends on:
ii  libc6              2.13-21         
ii  libffi5            3.0.10-3        
ii  libpcre3           8.12-4          
ii  libselinux1        2.1.0-4         
ii  multiarch-support  2.13-21         
ii  zlib1g             1:1.2.3.4.dfsg-3

Versions of packages libglib2.0-0 recommends:
ii  libglib2.0-data   2.30.2-4
ii  shared-mime-info  0.90-1  

libglib2.0-0 suggests no packages.

-- no debconf information





More information about the pkg-gnome-maintainers mailing list