@@ -80,6 +80,7 @@ omi_nasdaq_phlxoptions_topo_itch_v3_3.fields.trading_action_message = ProtoField
8080
8181-- Nasdaq PhlxOptions Topo Itch 3.3 generated fields
8282omi_nasdaq_phlxoptions_topo_itch_v3_3 .fields .message_index = ProtoField .new (" Message Index" , " nasdaq.phlxoptions.topo.itch.v3.3.messageindex" , ftypes .UINT16 )
83+ omi_nasdaq_phlxoptions_topo_itch_v3_3 .fields .timestamp = ProtoField .new (" Timestamp" , " nasdaq.phlxoptions.topo.itch.v3.3.timestamp" , ftypes .UINT64 )
8384
8485---- -------------------------------------------------------------------
8586-- Declare Dissection Options
@@ -103,6 +104,19 @@ omi_nasdaq_phlxoptions_topo_itch_v3_3.prefs.show_packet = Pref.bool("Show Packet
103104omi_nasdaq_phlxoptions_topo_itch_v3_3 .prefs .show_packet_header = Pref .bool (" Show Packet Header" , show .packet_header , " Parse and add Packet Header to protocol tree" )
104105omi_nasdaq_phlxoptions_topo_itch_v3_3 .prefs .show_message_index = Pref .bool (" Show Message Index" , show .message_index , " Show generated message index in protocol tree" )
105106
107+ -- Nanoseconds Display Preferences
108+ nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds_format = 2 -- 0=Raw, 1=TimeOfDay, 2=FullDateTime
109+ nasdaq_phlxoptions_topo_itch_v3_3 .utc_offset_hours = 5 -- Hours behind UTC (EST = 5, EDT = 4, UTC = 0)
110+
111+ local nanoseconds_format_enum = {
112+ { 1 , " Raw" , 0 },
113+ { 2 , " Time of Day" , 1 },
114+ { 3 , " Full DateTime" , 2 }
115+ }
116+
117+ omi_nasdaq_phlxoptions_topo_itch_v3_3 .prefs .nanoseconds_format = Pref .enum (" Nanoseconds Format" , 2 , " Nanoseconds display format" , nanoseconds_format_enum , false )
118+ omi_nasdaq_phlxoptions_topo_itch_v3_3 .prefs .utc_offset_hours = Pref .uint (" UTC Offset (hours)" , 5 , " Hours behind UTC for midnight calculation (EST=5, EDT=4, UTC=0)" )
119+
106120-- Handle changed preferences
107121function omi_nasdaq_phlxoptions_topo_itch_v3_3 .prefs_changed ()
108122
@@ -125,6 +139,14 @@ function omi_nasdaq_phlxoptions_topo_itch_v3_3.prefs_changed()
125139 if show .message_index ~= omi_nasdaq_phlxoptions_topo_itch_v3_3 .prefs .show_message_index then
126140 show .message_index = omi_nasdaq_phlxoptions_topo_itch_v3_3 .prefs .show_message_index
127141 end
142+
143+ -- Check Nanoseconds preferences
144+ if nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds_format ~= omi_nasdaq_phlxoptions_topo_itch_v3_3 .prefs .nanoseconds_format then
145+ nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds_format = omi_nasdaq_phlxoptions_topo_itch_v3_3 .prefs .nanoseconds_format
146+ end
147+ if nasdaq_phlxoptions_topo_itch_v3_3 .utc_offset_hours ~= omi_nasdaq_phlxoptions_topo_itch_v3_3 .prefs .utc_offset_hours then
148+ nasdaq_phlxoptions_topo_itch_v3_3 .utc_offset_hours = omi_nasdaq_phlxoptions_topo_itch_v3_3 .prefs .utc_offset_hours
149+ end
128150end
129151
130152
@@ -987,6 +1009,16 @@ nasdaq_phlxoptions_topo_itch_v3_3.second = {}
9871009-- Size: Second
9881010nasdaq_phlxoptions_topo_itch_v3_3 .second .size = 4
9891011
1012+ -- Store: Second
1013+ nasdaq_phlxoptions_topo_itch_v3_3 .second .store = nil
1014+
1015+ -- Generated: Second
1016+ nasdaq_phlxoptions_topo_itch_v3_3 .second .generated = function (value , range , packet , parent )
1017+ local display = nasdaq_phlxoptions_topo_itch_v3_3 .second .display (value )
1018+ local second = parent :add (omi_nasdaq_phlxoptions_topo_itch_v3_3 .fields .second , range , value , display )
1019+ second :set_generated ()
1020+ end
1021+
9901022-- Display: Second
9911023nasdaq_phlxoptions_topo_itch_v3_3 .second .display = function (value )
9921024 return " Second: " .. value
@@ -1332,6 +1364,63 @@ nasdaq_phlxoptions_topo_itch_v3_3.volume.dissect = function(buffer, offset, pack
13321364 return offset + length , value
13331365end
13341366
1367+ -- Timestamp
1368+ nasdaq_phlxoptions_topo_itch_v3_3 .timestamp = {}
1369+
1370+ -- Translate: Timestamp
1371+ nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .translate = function (nanoseconds , stored_second )
1372+ return UInt64 .new (stored_second * 1000000000 + nanoseconds )
1373+ end
1374+
1375+ -- Display: Timestamp
1376+ nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .display = function (nanoseconds , stored_second , packet )
1377+ -- Raw display mode
1378+ if nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds_format == 0 then
1379+ return " Timestamp: " .. (stored_second * 1000000000 + nanoseconds )
1380+ end
1381+
1382+ -- Full datetime mode (calculate from capture date + UTC offset)
1383+ if nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds_format == 2 and packet then
1384+ local capture_time = type (packet .abs_ts ) == " number" and packet .abs_ts or packet .abs_ts :tonumber ()
1385+ local utc_offset_seconds = nasdaq_phlxoptions_topo_itch_v3_3 .utc_offset_hours * 3600
1386+ local local_midnight = math.floor ((capture_time - utc_offset_seconds ) / 86400 ) * 86400 + utc_offset_seconds
1387+ local full_seconds = local_midnight + stored_second
1388+
1389+ return " Timestamp: " .. os.date (" %Y-%m-%d %H:%M:%S." , full_seconds ).. string.format (" %09d" , nanoseconds )
1390+ end
1391+
1392+ -- Time of day mode
1393+ return " Timestamp: " .. os.date (" %H:%M:%S." , stored_second ).. string.format (" %09d" , nanoseconds )
1394+ end
1395+
1396+ -- Composite: Timestamp
1397+ nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .composite = function (buffer , offset , stored_second , packet , parent )
1398+ local length = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .size
1399+ local range = buffer (offset , length )
1400+ local nanoseconds = range :uint ()
1401+ local value = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .translate (nanoseconds , stored_second )
1402+ local display = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .display (nanoseconds , stored_second )
1403+ parent = parent :add (omi_nasdaq_phlxoptions_topo_itch_v3_3 .fields .timestamp , range , value , display )
1404+
1405+ nasdaq_phlxoptions_topo_itch_v3_3 .second .generated (stored_second , range , packet , parent )
1406+
1407+ display = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .display (nanoseconds )
1408+ parent :add (omi_nasdaq_phlxoptions_topo_itch_v3_3 .fields .nanoseconds , range , nanoseconds , display )
1409+
1410+ return offset + length , value
1411+ end
1412+
1413+ -- Dissect: Timestamp
1414+ nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect = function (buffer , offset , packet , parent )
1415+ local stored_second = nasdaq_phlxoptions_topo_itch_v3_3 .second .store
1416+
1417+ if stored_second ~= nil then
1418+ return nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .composite (buffer , offset , stored_second , packet , parent )
1419+ end
1420+
1421+ return nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , offset , packet , parent )
1422+ end
1423+
13351424
13361425---- -------------------------------------------------------------------
13371426-- Dissect Nasdaq PhlxOptions Topo Itch 3.3
@@ -1358,7 +1447,7 @@ nasdaq_phlxoptions_topo_itch_v3_3.broken_trade_report_message.fields = function(
13581447 local index = offset
13591448
13601449 -- Nanoseconds: 4 Byte Unsigned Fixed Width Integer
1361- index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , index , packet , parent )
1450+ index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect (buffer , index , packet , parent )
13621451
13631452 -- Option Id: 4 Byte Unsigned Fixed Width Integer
13641453 index , option_id = nasdaq_phlxoptions_topo_itch_v3_3 .option_id .dissect (buffer , index , packet , parent )
@@ -1415,7 +1504,7 @@ nasdaq_phlxoptions_topo_itch_v3_3.trade_report_message.fields = function(buffer,
14151504 local index = offset
14161505
14171506 -- Nanoseconds: 4 Byte Unsigned Fixed Width Integer
1418- index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , index , packet , parent )
1507+ index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect (buffer , index , packet , parent )
14191508
14201509 -- Option Id: 4 Byte Unsigned Fixed Width Integer
14211510 index , option_id = nasdaq_phlxoptions_topo_itch_v3_3 .option_id .dissect (buffer , index , packet , parent )
@@ -1474,7 +1563,7 @@ nasdaq_phlxoptions_topo_itch_v3_3.long_best_bid_update_message.fields = function
14741563 local index = offset
14751564
14761565 -- Nanoseconds: 4 Byte Unsigned Fixed Width Integer
1477- index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , index , packet , parent )
1566+ index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect (buffer , index , packet , parent )
14781567
14791568 -- Option Id: 4 Byte Unsigned Fixed Width Integer
14801569 index , option_id = nasdaq_phlxoptions_topo_itch_v3_3 .option_id .dissect (buffer , index , packet , parent )
@@ -1530,7 +1619,7 @@ nasdaq_phlxoptions_topo_itch_v3_3.long_best_ask_update_message.fields = function
15301619 local index = offset
15311620
15321621 -- Nanoseconds: 4 Byte Unsigned Fixed Width Integer
1533- index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , index , packet , parent )
1622+ index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect (buffer , index , packet , parent )
15341623
15351624 -- Option Id: 4 Byte Unsigned Fixed Width Integer
15361625 index , option_id = nasdaq_phlxoptions_topo_itch_v3_3 .option_id .dissect (buffer , index , packet , parent )
@@ -1586,7 +1675,7 @@ nasdaq_phlxoptions_topo_itch_v3_3.short_best_bid_update_message.fields = functio
15861675 local index = offset
15871676
15881677 -- Nanoseconds: 4 Byte Unsigned Fixed Width Integer
1589- index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , index , packet , parent )
1678+ index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect (buffer , index , packet , parent )
15901679
15911680 -- Option Id: 4 Byte Unsigned Fixed Width Integer
15921681 index , option_id = nasdaq_phlxoptions_topo_itch_v3_3 .option_id .dissect (buffer , index , packet , parent )
@@ -1642,7 +1731,7 @@ nasdaq_phlxoptions_topo_itch_v3_3.short_best_ask_update_message.fields = functio
16421731 local index = offset
16431732
16441733 -- Nanoseconds: 4 Byte Unsigned Fixed Width Integer
1645- index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , index , packet , parent )
1734+ index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect (buffer , index , packet , parent )
16461735
16471736 -- Option Id: 4 Byte Unsigned Fixed Width Integer
16481737 index , option_id = nasdaq_phlxoptions_topo_itch_v3_3 .option_id .dissect (buffer , index , packet , parent )
@@ -1700,7 +1789,7 @@ nasdaq_phlxoptions_topo_itch_v3_3.long_best_bid_and_ask_update_message.fields =
17001789 local index = offset
17011790
17021791 -- Nanoseconds: 4 Byte Unsigned Fixed Width Integer
1703- index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , index , packet , parent )
1792+ index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect (buffer , index , packet , parent )
17041793
17051794 -- Option Id: 4 Byte Unsigned Fixed Width Integer
17061795 index , option_id = nasdaq_phlxoptions_topo_itch_v3_3 .option_id .dissect (buffer , index , packet , parent )
@@ -1764,7 +1853,7 @@ nasdaq_phlxoptions_topo_itch_v3_3.short_best_bid_and_ask_update_message.fields =
17641853 local index = offset
17651854
17661855 -- Nanoseconds: 4 Byte Unsigned Fixed Width Integer
1767- index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , index , packet , parent )
1856+ index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect (buffer , index , packet , parent )
17681857
17691858 -- Option Id: 4 Byte Unsigned Fixed Width Integer
17701859 index , option_id = nasdaq_phlxoptions_topo_itch_v3_3 .option_id .dissect (buffer , index , packet , parent )
@@ -1824,7 +1913,7 @@ nasdaq_phlxoptions_topo_itch_v3_3.security_open_closed_message.fields = function
18241913 local index = offset
18251914
18261915 -- Nanoseconds: 4 Byte Unsigned Fixed Width Integer
1827- index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , index , packet , parent )
1916+ index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect (buffer , index , packet , parent )
18281917
18291918 -- Option Id: 4 Byte Unsigned Fixed Width Integer
18301919 index , option_id = nasdaq_phlxoptions_topo_itch_v3_3 .option_id .dissect (buffer , index , packet , parent )
@@ -1872,7 +1961,7 @@ nasdaq_phlxoptions_topo_itch_v3_3.trading_action_message.fields = function(buffe
18721961 local index = offset
18731962
18741963 -- Nanoseconds: 4 Byte Unsigned Fixed Width Integer
1875- index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , index , packet , parent )
1964+ index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect (buffer , index , packet , parent )
18761965
18771966 -- Option Id: 4 Byte Unsigned Fixed Width Integer
18781967 index , option_id = nasdaq_phlxoptions_topo_itch_v3_3 .option_id .dissect (buffer , index , packet , parent )
@@ -1930,7 +2019,7 @@ nasdaq_phlxoptions_topo_itch_v3_3.options_directory_message.fields = function(bu
19302019 local index = offset
19312020
19322021 -- Nanoseconds: 4 Byte Unsigned Fixed Width Integer
1933- index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , index , packet , parent )
2022+ index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect (buffer , index , packet , parent )
19342023
19352024 -- Option Id: 4 Byte Unsigned Fixed Width Integer
19362025 index , option_id = nasdaq_phlxoptions_topo_itch_v3_3 .option_id .dissect (buffer , index , packet , parent )
@@ -2009,7 +2098,7 @@ nasdaq_phlxoptions_topo_itch_v3_3.system_event_message.fields = function(buffer,
20092098 local index = offset
20102099
20112100 -- Nanoseconds: 4 Byte Unsigned Fixed Width Integer
2012- index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .nanoseconds .dissect (buffer , index , packet , parent )
2101+ index , nanoseconds = nasdaq_phlxoptions_topo_itch_v3_3 .timestamp .dissect (buffer , index , packet , parent )
20132102
20142103 -- Event Code: 1 Byte Ascii String Enum with 8 values
20152104 index , event_code = nasdaq_phlxoptions_topo_itch_v3_3 .event_code .dissect (buffer , index , packet , parent )
@@ -2060,6 +2149,9 @@ nasdaq_phlxoptions_topo_itch_v3_3.timestamp_message.fields = function(buffer, of
20602149 -- Second: 4 Byte Unsigned Fixed Width Integer
20612150 index , second = nasdaq_phlxoptions_topo_itch_v3_3 .second .dissect (buffer , index , packet , parent )
20622151
2152+ -- Store Second Value
2153+ nasdaq_phlxoptions_topo_itch_v3_3 .second .store = second
2154+
20632155 return index
20642156end
20652157
0 commit comments