GNOME Bugzilla – Bug 704039
[PATCH] time zone is not respected on windows
Last modified: 2018-06-29 23:17:19 UTC
How to reproduce: 1. Go to register and try to enter a new transaction. 2. In the date field, press "t" key in order to set it "today". For example, now is about 2013-07-12 02:00am (GMT+8) If I press "t", the date field become 2013-07-11. I guess the reason of wrong date is 2013-07-12 02:00 (GMT+8) == 2013-07-11 18:00 UTC GnuCash 2.53, windows. IIRC, 2.4x doesn't have this problem.
Related bug: https://bugzilla.gnome.org/show_bug.cgi?id=699422 diff --git a/src/libqof/qof/gnc-date.c b/src/libqof/qof/gnc-date.c index 84d6388..0609c62 100644 --- a/src/libqof/qof/gnc-date.c +++ b/src/libqof/qof/gnc-date.c @@ -111,7 +111,7 @@ gnc_g_time_zone_new_local (void) gint bias = tzinfo.Bias + tzinfo.StandardBias; gint hours = -bias / 60; // 60 minutes per hour gint minutes = (bias < 0 ? -bias : bias) % 60; - gchar *tzstr = g_strdup_printf ("%+03d%02d", hours, minutes); + gchar *tzstr = g_strdup_printf ("%+02d%02d", hours, minutes); GTimeZone *tz = g_time_zone_new(tzstr); g_free (tzstr); return tz;
https://bugzilla.gnome.org/show_bug.cgi?id=699977 may be relevant.
Patch/diff looks good to me and should be committed. Unfortunately the gnucash servers seem to be down right now, but once they're up again, this should go in.
I have committed your patch as r23155 on the trunk branch. Thank you very much! For the related bugs, I will ask the respective posters to verify if your patch fixes their bugs as well. I assume it will. After confirmation, these bugs can be closed as duplicates of this one.
I verified this bug using nightly build. http://code.gnucash.org/builds/win32/trunk/gnucash-2.5.4-2013-09-04-git-6ee4202+-setup.exe
Thank you.
just found another diff --git a/src/libqof/qof/gnc-date.c b/src/libqof/qof/gnc-date.c index 0609c62..ecc951c 100644 --- a/src/libqof/qof/gnc-date.c +++ b/src/libqof/qof/gnc-date.c @@ -142,7 +142,7 @@ gnc_g_time_zone_adjust_for_dst (GTimeZone* tz, GDateTime *date) bias = tzinfo.Bias + tzinfo.DaylightBias; hours = -bias / 60; // 60 minutes per hour minutes = (bias < 0 ? -bias : bias) % 60; - tzstr = g_strdup_printf ("%+03d%02d", hours, minutes); + tzstr = g_strdup_printf ("%+02d%02d", hours, minutes); tz = g_time_zone_new(tzstr); } #endif
Running 2.5.5 in a Windows 7 64 bit machine set to Central Daylight Time (UTC -6:00) at 9:45 pm, pressing 'T' in the date posted field of a register2 account view sets the date to tomorrow's date. Pressing shift+ or shift- on a numeric keyboard shifts the date 7 days, Alt+ or Alt- on a numeric keyboard shifts month by one and Ctrl+ or Ctrl- on a numeric keyboard shifts year by one.
(In reply to comment #7) > just found another > > diff --git a/src/libqof/qof/gnc-date.c b/src/libqof/qof/gnc-date.c > index 0609c62..ecc951c 100644 > --- a/src/libqof/qof/gnc-date.c > +++ b/src/libqof/qof/gnc-date.c > @@ -142,7 +142,7 @@ gnc_g_time_zone_adjust_for_dst (GTimeZone* tz, GDateTime > *date) > bias = tzinfo.Bias + tzinfo.DaylightBias; > hours = -bias / 60; // 60 minutes per hour > minutes = (bias < 0 ? -bias : bias) % 60; > - tzstr = g_strdup_printf ("%+03d%02d", hours, minutes); > + tzstr = g_strdup_printf ("%+02d%02d", hours, minutes); > tz = g_time_zone_new(tzstr); > } > #endif Committed as r23179, thanks.
(In reply to comment #8) > Running 2.5.5 in a Windows 7 64 bit machine set to Central Daylight Time (UTC > -6:00) at 9:45 pm, pressing 'T' in the date posted field of a register2 account > view sets the date to tomorrow's date. Please try again with tomorrow's nightly. > Pressing shift+ or shift- on a numeric keyboard shifts the date 7 days, Alt+ or > Alt- on a numeric keyboard shifts month by one and Ctrl+ or Ctrl- on a numeric > keyboard shifts year by one. Sounds like a feature. What's the problem?
Actually, yes, the other features, like the 'T(oday)' feature, are nice. I found them in an old bug report, and because they work, I really want them to be documented in the user manual. I listed them here because I did not want to forget about them. To date I have not researched where to put them in the documentation. Also, I do not know if they work when there is no separate numeric keypad. I think that should also be mentioned in the documentation. Alas, I have not developed the ability to use nightly builds. I will wait for the 2.5.6 release.
> Alas, I have not developed the ability to use nightly builds. I will wait for > the 2.5.6 release. Download from here: http://code.gnucash.org/builds/win32/trunk/ But I see that they're borked again, so it will probably be a day or two.
Fixed. Verified using nightly build.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=704039. Please update any external references or bookmarks.