GNOME Bugzilla – Bug 615901
[PATCH] add g_time_val_timezone_bias and g_time_val_timezone_name
Last modified: 2010-05-31 10:54:12 UTC
These are easy under Linux, but require care more code and care under other operating systems. They can be implemented portably though! I have separate Windows versions because they can easily support UTF-8, since timezone names are interestingly kept _only_ in Unicode by Windows. The Windows version should use GetTimeZoneInformationForYear under Vista or later, but I don't have a machine that has it for testing. An automated test is difficult, here is what I used: #include <glib.h> int main(int argc, char **argv) { GDate *date = g_date_new_dmy (14, 4, 2010); GTimeVal tv; printf ("%d-%d-%d\n", g_date_get_day (date), g_date_get_month (date), g_date_get_year (date)); g_date_get_time_val (date, &tv); g_date_set_time_val (date, &tv); printf ("%d-%d-%d\n", g_date_get_day (date), g_date_get_month (date), g_date_get_year (date)); printf ("%s %d\n", g_time_val_timezone_name (&tv), g_time_val_timezone_bias (&tv)); g_date_set_month (date, 2); g_date_get_time_val (date, &tv); g_date_set_time_val (date, &tv); printf ("%d-%d-%d\n", g_date_get_day (date), g_date_get_month (date), g_date_get_year (date)); printf ("%s %d\n", g_time_val_timezone_name (&tv), g_time_val_timezone_bias (&tv)); }
Created attachment 158855 [details] [review] patch
See bug 50076.
Seems like it is subsumed by the functionality in there.