Author

Topic: [PULL] Bugfix for rfc1123Time (Read 1131 times)

legendary
Activity: 2576
Merit: 1186
April 09, 2011, 01:39:54 PM
#5
Ok, rewrote my branch to only set locale and hard-code "+0000"; good idea.
legendary
Activity: 1596
Merit: 1091
April 09, 2011, 01:11:34 PM
#4
GMT is always +0:00, so why not hardcode that instead of using %z or %Z?

Yep, that should work just fine.

legendary
Activity: 1652
Merit: 2216
Chief Scientist
April 09, 2011, 12:25:16 PM
#3
GMT is always +0:00, so why not hardcode that instead of using %z or %Z?

RE: changing locale:  good idea.
legendary
Activity: 2576
Merit: 1186
April 08, 2011, 11:08:00 PM
#2
Correction to my above summary: bitcoind does use gmtime to get the correct UTC time, but the problem was that Windows still tries to put the local timezone for %Z rather than UTC as is being encoded.

Actually, according to the RFC, numeric timezones should be used (not names). So rather than force TZ to UTC, the buffer should be extended and %z used instead of %Z. I do not have any idea if Windows complies with %z better than %Z, so I am leaving the temporarily-set-TZ hack in. Otherwise, my branch now uses %z.

Please note that the timezone is not the only issue here. The locale must also be forced to POSIX to get the usual weekday (Sun-Sat) and month (Jan-Dec) abbreviations, rather than some local variant.
legendary
Activity: 2576
Merit: 1186
April 08, 2011, 10:39:58 PM
#1
Someone in #bitcoin-discussion was having problems with JSON-RPC and it turned out to be related to their timezone overflowing the rfc1123Time function's buffer. My 'rfc1123Time_localefix' branch addresses the problem by forcing the locale and timezone to POSIX and UTC for its purposes (and resetting it back later).

git fetch git://gitorious.org/~Luke-Jr/bitcoin/luke-jr-bitcoin.git rfc1123Time_localefix && git diff 454bc8..FETCH_HEAD && git merge FETCH_HEAD

I suspect the JSON-RPC has other locale problems as well, in case someone wants to look into it further.
Jump to: