[maemo-developers] [maemo-developers] TZ environment variable in desktop application
From: Simon Budig simon at budig.deDate: Fri Nov 11 21:38:37 EET 2005
- Previous message: [maemo-developers] Maemo1.1 RC6 updated to the repository
- Next message: [maemo-developers] Where do we send 770 usability issues?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all. As some of you know, I am writing a applet for the statusbar that simply displays a clock. It turns out that this is not exactly easy... For some reason the TZ environment variable is set inside the maemo_af_desktop application (which is the process the statusbar applets run in). Unfortunately it seems to be set to a nonsensical value (for me it was something like "8#\x14A", where \x14 stands for chr(0x14)) which gets interpreted as "GMT" by functions like localtime() etc. So currently I do this to determine the time: /* unset TZ */ tz_str = g_strdup (g_getenv ("TZ")); g_unsetenv ("TZ"); gettimeofday (&tv, NULL); time_info = localtime (&tv.tv_sec); /* restore TZ */ g_setenv ("TZ", tz_str, FALSE); g_free (tz_str); and I wonder how the desktop clock applet from nokia manages to display the correct time. Can somebody shed some light on this? Is it really necessary that the desktop application messes with TZ? Is the "8#\x14A"-value anything useful? Can I omit the restoring without messing anything up? BTW.: The clock application crashes when setting the timezone and/or time. Is this bug known? Oh, and a kind of announcement: the current version of the status bar clock uses the trick above to determine the time correctly, reacts on clicks with the pen (as requested by some people on IRC) and should do correct power management: http://www.home.unix-ag.org/simon/files/n770/panelclock_0.3_arm.deb Bye, Simon -- simon at budig.de http://simon.budig.de/
- Previous message: [maemo-developers] Maemo1.1 RC6 updated to the repository
- Next message: [maemo-developers] Where do we send 770 usability issues?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]