Time since January 1, 1970 in microseconds (µs) - MetaTrader 5 Library

Simple class for getting the number of microseconds (μs) that have elapsed since January 1, 1970.
The error of this method is about 0.5 milliseconds. This is due to the discrete time nature of updating the TimeLocal() function.
At the beginning of your program (script, indicator or advisor) you need to create an instance of this class:
#includeC time μs t;
There are three methods in this class whose names describe their purpose:
Oolong gets the local time(); Oolong gets the time trading server(); Oolong gets the Greenwich Mean Time();
A test script demonstrating such work is provided:
#includeC time μs t; blank start () { Although (! stop ()) { comment ( "local-" + string ( t.GetTimeLocal() ) + " µs\nGMT - " + string ( t.GetTimeGMT() ) + "µs\nServer-" + string ( t.GetTimeTradeServer() ) + "microseconds" ); } Comment ( "" ); } //+------------------------------------------------------------------+

Attachment download
📎 timeus.mqh (2.61 KB)
📎 test_timeus.mq5 (1.7 KB)
Source: MQL5 #35815
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •