Skip to content
All library documents

Handling Millisecond Timestamps with an Extended Date-Time Structure

Article MQL5 code base

Summary

This document presents a programming approach for working with millisecond timestamps in a trading platform. It extends a date-time structure with a millisecond field and methods to convert between milliseconds since the Unix epoch and ordinary date-time values. The extension also supports incrementing and decrementing the millisecond component alongside existing time units, which is intended to simplify work with tick data retrieved over time ranges.

The author explains that raw millisecond counts are hard to interpret, while conventional date-time structures do not preserve the sub-second component. An additional date-time field is maintained for convenient observation, at the cost of some overhead and updates during time changes. The document offers a design rationale and a qualitative test description, but no benchmark, detailed test results, or discussion of edge cases such as overflow or time-zone handling. Its usefulness is primarily for implementation work with precise tick timestamps rather than trading signal design.

Key ideas

  • A date-time structure can be extended with a millisecond field to represent sub-second tick times.
  • Conversion methods can map between epoch milliseconds and conventional date-time values.
  • Increment and decrement operations can be extended to adjust milliseconds as well as larger time units.
  • A cached observation field aids inspection but adds overhead, and the document provides no performance benchmarks.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.