MT5 Python API vs MQL5 — BTCUSD timestamp and UTC interpretation

Hello MetaTrader 5 / MQL5 Community,
I am investigating a timestamp interpretation discrepancy between the MetaTrader 5 Python API and native MQL5 data for BTCUSD on a demo server.
Environment:
Platform: MetaTrader 5
Broker server: InfinoxLimited-MT5Demo
Symbol: BTCUSD
Interfaces: MetaTrader5 Python package and native MQL5
Timeframes: H1, M15 and M5
Account type: Demo
INFINOX Technical Support, under ticket #179925, advised me to contact MetaTrader technical specialists regarding Python API timestamps, historical candles, ticks and server-time conventions.
Technical questions:
Does the Python MetaTrader5 API return tick timestamps (time and time_msc) as Unix timestamps representing UTC, regardless of the broker's server timezone?
Are the timestamps returned by copy_rates_from_pos() and copy_ticks_range() based on the same time convention as the timestamps returned by native MQL5 CopyTime() and SymbolInfoTick()?
Can broker server timezone settings or daylight-saving-time changes affect the interpretation of these timestamps?
What is the correct method to compare raw timestamps between Python and MQL5 without accidentally applying timezone offsets twice?
How should TimeCurrent(), TimeTradeServer() and TimeGMT() be interpreted when investigating differences between tick timestamps and candle opening times?
Is there an official MetaQuotes reference or recommended diagnostic procedure for confirming timestamp consistency between Python and MQL5?
Current investigation status:
A read-only MQL5 diagnostic script has passed static review. It is designed to capture raw tick timestamps, prices, H1/M15/M5 candle opening times and separate capture windows.
However, the script has not been compiled or executed, and no native diagnostic measurements have been collected.
Therefore, I am not claiming that a Python/MQL5 timestamp mismatch has already been confirmed by this script.
My objective is to establish the documented timestamp conventions before performing further controlled diagnostics.
I am not requesting trading advice or strategy assistance. I only need clarification of the MT5 timestamp semantics and the correct comparison methodology.
Thank you for your technical guidance.
Willian, a confusão costuma vir do nome. O MT5 não guarda o horário em UTC de verdade: tanto o MQL5 quanto o pacote Python devolvem o horário do servidor da corretora contado como segundos desde 1970, sem fuso nenhum aplicado. A documentação do copy_rates_from chama isso de "UTC time zone (without the shift)", e é aí que muita gente aplica o fuso duas vezes. Na prática, o número que sai em rates['time'] no Python é o mesmo inteiro que CopyTime() devolve no MQL5 para a mesma barra, e o time_msc do copy_ticks_range é o mesmo do MqlTick.time_msc.

Para comparar sem errar, compare os inteiros crus, sem pd.to_datetime(..., utc=True) seguido de tz_convert. Para saber o fuso do servidor, use TimeTradeServer() - TimeGMT(): o TimeTradeServer é a hora do servidor estimada pelo terminal e o TimeGMT é o GMT calculado pelo relógio do seu PC, então a diferença dá o offset do servidor naquele momento. O TimeCurrent é a hora da última cotação recebida de qualquer símbolo do Market Watch; com BTCUSD lá, que negocia o tempo todo, fica colado na hora do servidor, mas se nada estiver cotando ele fica para trás.

O horário de verão afeta, sim. Se o servidor passa de GMT+2 para GMT+3, o offset muda no meio do histórico e uma barra H1 antiga e uma recente não convertem pelo mesmo número. Por isso eu guardaria o horário cru do servidor e só converteria para UTC na análise, com as datas da troca na mão.

Um script para imprimir os três relógios, o offset, o último tick e as três últimas barras H1, e o equivalente em Python para colocar lado a lado:
void OnStart()
  {
   MqlTick t;
   if(!SymbolInfoTick(_Symbol, t))
     {
      Print("sem tick para ", _Symbol);
      return;
     }
   datetime srv = TimeTradeServer();
   datetime gmt = TimeGMT();
   PrintFormat("TimeCurrent=%I64d TimeTradeServer=%I64d TimeGMT=%I64d offset=%.2f h",
               (long)TimeCurrent(), (long)srv, (long)gmt, (double)(srv - gmt) / 3600.0);
   PrintFormat("tick time=%I64d time_msc=%I64d (%s)",
               (long)t.time, t.time_msc, TimeToString(t.time, TIME_DATE|TIME_SECONDS));
   datetime bar[];
   if(CopyTime(_Symbol, PERIOD_H1, 0, 3, bar) == 3)
      for(int i = 0; i < 3; i++)
         PrintFormat("H1[%d]=%I64d (%s)", i, (long)bar[i], TimeToString(bar[i]));
  }
import MetaTrader5 as mt5

mt5.initialize()
t = mt5.symbol_info_tick("BTCUSD")
r = mt5.copy_rates_from_pos("BTCUSD", mt5.TIMEFRAME_H1, 0, 3)
print(t.time, t.time_msc)
print([int(x) for x in r['time']])
mt5.shutdown()

Se os inteiros baterem e só a exibição divergir, o problema está na conversão do lado do Python, não no dado.