question

Upvotes
Accepted
24 2 3 12

How to identify and convert millisecond _MS time fields ?

I would like to convert the millisecond time field (ex: SALTIM_MS, QUOTIM_MS, ...) that are stored as unsigned integers to HH:MM:SS.mmm format. As the RWF field type for these fields are UINT64, they can't be easily identified as time fields during decoding of the message.

  • What is TR's recommended way to identify the millisecond fields that need special conversion logic ?
  • Does the ETA API provide an utility method to convert millisecond data to string format HH:MM:SS.mmm ?
  • If the API doesn't provide a method to identify and convert millisecond time fields, is it safe to look for the suffix "_MS" on any of the field name and apply conversion logic to extract HH, MM, SS and millisecond data ? In other words, I don't want to leave out a time field with out the suffix _MS that has a millisecond value stored as integer.
elektronrefinitiv-realtimeelektron-sdkrrteta-apielektron-transport-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
38.1k 71 35 53

Yes, you need to use both the suffix "_MS" and UINT64 to identify those fields because there are others fields which have suffix "_MS" and TIME as a RWF type.

TRDTIM_MS  "TRDTIM MS"           3853  NULL        INTEGER            15  UINT64           4
SALTIM_MS  "SALTIM MS"           3854  NULL        INTEGER            15  UINT64           4
QUOTIM_MS  "QUOTIM MS"           3855  NULL        INTEGER            15  UINT64           4
TIMCOR_MS  "TIMCOR MS"           3856  NULL        INTEGER            15  UINT64           4
...
...

EURO_AL_MS "EURO ASK LOW TIME"  14169  NULL        INTEGER            15  TIME             5
EURO_AO_MS "EURO ASK OPEN TIME" 14170  NULL        INTEGER            15  TIME             5
EURO_BH_MS "EURO BID HIGH TIME" 14171  NULL        INTEGER            15  TIME             5

The values in those fields (with suffix "_MS" and UINT64) represent time stamp in milliseconds within a day. You can use the below logic to convert milliseconds within a day to time.

int msec = time_ms%1000;
int seconds = (((int)(time_ms/1000)) % 60); 
int minutes = (((int)(time_ms/60000)) % 60); 
int hours = (((int)(time_ms/3600000)) % 24); 
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
1 0 1 0

Due to an outage of the Thomson Reuters Developer Community email notification system from 2:30 PM CDT on November 29th until 9:00 AM CDT on November 30th we are posting to all questions updated during this timeframe in order to ensure all customers receive all relevant email updates. Please review this question, and its associated answers, in order to ensure you are aware of any possible updates that may have occurred during this outage. We apologize for the delay and any inconvenience this has caused.

Matthew Logterman, J.D.

Sr. Product Manager, Thomson Reuters Developer Community

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea