Skip to content

Commit

Permalink
ADD: Add missing ts_in_delta method for StatMsg
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen committed May 20, 2024
1 parent 5caf4dc commit a798787
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
- Added new `DBNError` Python exception that's now the primary exception raised by
`databento_dbn`
- Improved async performance of decoding DBN files
- Added `StatMsg::ts_in_delta()` method that returns a `time::Duration` for consistency
with other records with a `ts_in_delta` field

### Breaking changes
- Changed type of `flags` in `MboMsg`, `TradeMsg`, `Mbp1Msg`, `Mbp10Msg`, and `CbboMsg`
Expand Down
5 changes: 5 additions & 0 deletions rust/dbn/src/record/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,11 @@ impl StatMsg {
Error::conversion::<StatUpdateAction>(format!("{:04X}", self.update_action))
})
}

/// Parses the raw `ts_in_delta`—the delta of `ts_recv - ts_exchange_send`—into a duration.
pub fn ts_in_delta(&self) -> time::Duration {
time::Duration::new(0, self.ts_in_delta)
}
}

impl ErrorMsgV1 {
Expand Down

0 comments on commit a798787

Please sign in to comment.