ea-health-monitor/mql4/Indicators/EAHealth/EAClock.mqh
27 lines
1.1 KiB
MQL5
//+------------------------------------------------------------------+
//| EAClock.mqh |
//| Copyright 2026, Allan Niñal |
//| https://www.allanninal.dev/mql5 |
//+------------------------------------------------------------------+
//| The millisecond clock of the panel: wall clock live, simulated |
//| server time in the tester. |
//+------------------------------------------------------------------+
// SPDX-License-Identifier: LicenseRef-PolyForm-Noncommercial-1.0.0 (see LICENSE)
#ifndef EACLOCK_MQH
#define EACLOCK_MQH
//--- "now" in ms: wall clock live, simulated server time in the tester (which runs far faster than real time)
ulong SDNowMs()
{
if(IsTesting())
return((ulong)TimeCurrent()*1000);
static ulong hi=0; // MQL4 has only the 32-bit GetTickCount: count its wraps (every 49.7 days)
static uint last=0;
uint now=GetTickCount();
if(now<last)
hi+=((ulong)1<<32);
last=now;
return(hi+now);
}
#endif