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.
Sort by:
1 - 1 of 11
    User: "Jirapongse"
    ✭✭✭✭✭
    Accepted Answer

    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);