[QFJ-104] Time Zone Problem Created: 13/Nov/06 Updated: 11/May/07 Resolved: 11/May/07 |
|
Status: | Closed |
Project: | QuickFIX/J |
Component/s: | Engine |
Affects Version/s: | 1.0.4 |
Fix Version/s: | None |
Type: | Improvement | Priority: | Default |
Reporter: | Welf Wustlich | Assignee: | Steve Bate |
Resolution: | Not a bug | Votes: | 0 |
Labels: | None | ||
Environment: |
java netbeans |
Description |
We are getting market data snapshots from Forex Hotspot Thanks, Welf |
Comments |
Comment by Steve Bate [ 14/Nov/06 ] |
QFJ will parse the timestamp string as a UTC date. At that point it's a java.util.Date object. If you format it back to a string (for a database query, for example) you must use a formatter that is configured for the UTC timezone. Otherwise, the java.util.DateFormatter will format the java.util.Date for the default (usually local) time zone. Could this explain the behavior you are seeing? If not, can you submit a simple unit test showing the problem you are seeing? Thanks. |
Comment by Welf Wustlich [ 14/Nov/06 ] |
Our solution now is to convert the local timestamp back to UTC, but this solution is slower and less stable than if we could simply switch of the conversion. calls in UtcTimestampConverter (also in QFJ): This last function makes all the conversions to local time ;-(. We are calling: What was confusing us: Question: Why this conversion and how to avoid without a complicated conversion back to UTC. Best regards, Welf |
Comment by Steve Bate [ 10/May/07 ] |
I'm sorry, but I don't understand the issue here. The UtcTimestampConverter uses the UTC time zone when parsing a timestamp string, not the local time. Are you sure you aren't printing the Date returned from the conversion using either Date.toString() or a DateFormatter that hasn't been configured for UTC? If you are using a DateFormatter (e.g., SimpleDateFormatter) you must set the correct timezone (UTC) on the formatter before printing the date. Otherwise, the formatter will print the date in the default timezone of the JVM (usually the local time zone). |
Comment by Steve Bate [ 11/May/07 ] |
QFJ only uses UTC. If you are using java.util.Date objects returned from the UTC converter and printing them or converting them to strings or using them in database queries you must be sure to associate the UTC time zone when performing those operations. That's outside the scope of QFJ. |