7#ifndef __TIME_SHIELD_TIME_UTILS_MQH__
8#define __TIME_SHIELD_TIME_UTILS_MQH__
17#property copyright "Copyright 2025, NewYaroslav"
18#property link "https://github.com/NewYaroslav/time-shield-cpp"
30 static bool initialized =
false;
31 static long offset = 0;
33 long start_ts = TimeGMT();
34 ulong start_mc = GetMicrosecondCount();
35 long next_ts = start_ts;
36 while((next_ts = TimeGMT()) == start_ts) {
39 ulong next_mc = GetMicrosecondCount();
43 return (
long)GetMicrosecondCount() + offset;
constexpr int64_t NS_PER_US
Nanoseconds per microsecond.
constexpr int64_t MS_PER_SEC
Milliseconds per second.
constexpr int64_t US_PER_SEC
Microseconds per second.
const ts_us_t timestamp_us() noexcept
Get the current UTC timestamp in microseconds.
const ts_ms_t now() noexcept
Get the current UTC timestamp in milliseconds.
const ts_t ts() noexcept
Get the current UTC timestamp in seconds.
long microseconds()
Get the number of microseconds since the UNIX epoch.
const T us_of_sec() noexcept
Get the microsecond part of the current second.
const ts_t timestamp() noexcept
Get the current UTC timestamp in seconds.
const fts_t ftimestamp() noexcept
Get the current UTC timestamp in floating-point seconds.
const T ns_of_sec() noexcept
Get the nanosecond part of the current second.
const ts_us_t ts_us() noexcept
Get the current UTC timestamp in microseconds.
const ts_ms_t ts_ms() noexcept
Get the current UTC timestamp in milliseconds.
const ts_ms_t timestamp_ms() noexcept
Get the current UTC timestamp in milliseconds.
const fts_t fts() noexcept
Get the current UTC timestamp in floating-point seconds.
const T ms_of_sec() noexcept
Get the millisecond part of the current second.
Main namespace for the Time Shield library.