Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
test_time_zone_matrix.mq5
Go to the documentation of this file.
1//+------------------------------------------------------------------+
2//| test_time_zone_matrix.mq5 |
3//| Time Shield - Function Test |
4//| Copyright 2025, NewYaroslav |
5//| https://github.com/NewYaroslav/time-shield-cpp |
6//+------------------------------------------------------------------+
7#property script_show_inputs
8#property strict
9
10#include <TimeShield.mqh>
11
12void OnStart() {
13 time_shield::init();
14
15 datetime ist_local = (datetime)time_shield::to_ts(2024, time_shield::JUL, 15, 12, 0, 0);
16 datetime expected_gmt = (datetime)time_shield::to_ts(2024, time_shield::JUL, 15, 6, 30, 0);
17 datetime gmt_from_ist = time_shield::ist_to_gmt(ist_local);
18 if(gmt_from_ist == expected_gmt)
19 Print("IST -> GMT passed");
20 else
21 Print("IST -> GMT failed: ", gmt_from_ist, " != ", expected_gmt);
22
23 datetime myt_from_ist = time_shield::convert_time_zone(ist_local, time_shield::IST, time_shield::MYT);
24 datetime expected_myt = (datetime)time_shield::to_ts(2024, time_shield::JUL, 15, 14, 30, 0);
25 if(myt_from_ist == expected_myt)
26 Print("IST -> MYT passed");
27 else
28 Print("IST -> MYT failed: ", myt_from_ist, " != ", expected_myt);
29
30 datetime kyiv_local = (datetime)time_shield::to_ts(2024, time_shield::JUL, 15, 12, 0, 0);
31 if(time_shield::kyiv_to_gmt(kyiv_local) == time_shield::eet_to_gmt(kyiv_local))
32 Print("Kyiv alias passed");
33 else
34 Print("Kyiv alias failed");
35}