[QFJ-226] MDEntryTime/Date fields aren't parsed correctly when Daylight Savings time is in effect Created: 21/Aug/07  Updated: 27/Mar/08  Resolved: 06/Oct/07

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.2.1
Fix Version/s: None

Type: Bug Priority: Default
Reporter: Toli Kuznets Assignee: Steve Bate
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

FIX.4.4 protocol has MDEntryTime (273) and MDEntryDate (272) to specify the time/date of market data entries.

When you are trying to parse a market data incremental refresh (MsgType=X), and you have a MDEntryTime of "13:30:00" it will parse it using the UtcTimeOnlyConverter, but it'll parse the time relative to the January 1, 1970 date. As a result, in the summer you'll end up with times being off-by-one, bc January is not during DST.

The real way to parse the MDEntryTime is to combine it with the MDEntryDate, so that if the other field is present it should use it and then it'll have the right date and will have the DST value calculated correctly.

The workaround, for now, is to of course parse the entire date/time combined string together.

Here's the example portion of a message that'll break this (see fields 272/273):
8=FIX.4.4
35=X
...
268=1950
279=0
269=5
55=YHOO
270=23.6400
272=20070820
273=13:30:00.000
279=0
....



 Comments   
Comment by Steve Bate [ 24/Aug/07 ]

This is an interesting problem. In general, combining FIX fields to parse times would require some nontrivial extensions to the message metadata (data dictionary). Another option would be to always use the current UTC date to parse the times. It seems reasonable to interpret a time-only field in that way, although their may be other fields in the message that could specify a different date.

Comment by Steve Bate [ 31/Aug/07 ]

Does UTC have a DST adjustment? I tried googling for it but had trouble finding the answer.

Comment by Toli Kuznets [ 20/Sep/07 ]

I don't think that UTC has any provisions for DST adjustments at all - it's just meant to be an absolute.
From wikipedia:
The definition for time zones can be written in short form as UTC±n (or GMT±n), where n is the offset in hours. These examples give the local time at various locations at 12:00 UTC when daylight saving time (or summer time, etc.) is not in effect:

So it's explicitly not counting DST. another quote: "a location observing UTC+10 during standard time is at UTC+11 during DST".

i think using using current UTC date to parse time may be a reasonable approach, but then again, i'm sure there'll be situations under which that breaks if we are parsing some historical quotes, for example.

It's quite possible that this is bad design on the part of FIX and we'll just need to have special cases in the application code itself. QFJ may not have enough context to parse everything correctly.

Comment by Toli Kuznets [ 20/Sep/07 ]

UTC article: http://en.wikipedia.org/wiki/Time_zone#Standard_time_zones
DST article: http://en.wikipedia.org/wiki/Daylight_saving_time#Observance_practices

Comment by Steve Bate [ 06/Oct/07 ]

I agree that the FIX approach of having separate date and time fields is questionable. I'm going the leave the current implementation the way it is for now.

Comment by Toli Kuznets [ 27/Mar/08 ]

We ended up finding a workflow that works around this fairly cleanly.

We needed to display incoming times from a message in market data refresh with this code:

SimpleDateFormat simpleDateFortmat = new SimpleDateFormat("HH:mm");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
simpleDateFormat.format(msg.getUTCTimeOnly(MDEntryTime.FIELD))

Since QFJ uses the UTC timezone to parse the time value, this works out just fine.

Generated at Sun May 19 04:31:03 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.