some one can help me plz about offset with WebRequest - page 2

 

try this 

  string page=GMT_Time();
  int p1=StringFind(page,"<div id=\"time\">",0);
  if(p1!=-1){//find container div
    int p2=StringFind(page,"value=",p1);
    if(p2!=-1){//find hidden timestamp 
      int p3=StringFind(page,".",p2+7);
      if(p3!=-1){//find microsecond decimal point
        int length=p3-(p2+7);
        string timestamp=StringSubstr(page,p2+7,length);
        long t_msc=(long)StringToInteger(timestamp);
        datetime time_gmt=(datetime)(MathFloor(((double)t_msc)/1000.0));
        Print("Found time is "+TimeToString(time_gmt,TIME_DATE|TIME_MINUTES|TIME_SECONDS));
        }else{Print("Cannot find p3");}
      }else{Print("Cannot find p2");}
    }else{Print("Cannot find p1");}
 
ALI AMRIOUI #:

but GMT of MQL is attached to  the time of computer

if u have time local not correct u will have worrong GMT of MQL

That's true, but if your local time not correct, you will have other troubles.

You need to have your local time correctly synchronized anyway.

 
Alain Verleyen #:

That's true, but if your local time not correct, you will have other troubles.

You need to have your local time correctly synchronized anyway.

Also.

What is the delay to get the GMT from Internet this way ?

How do you know you will not have a X seconds delay for example, are you checking that in your code ?

 
Lorentzos Roussos #:

try this 

yeah its work like a charm

thanks bro and GOD bless u inshallah

but how i can get value GMT directly  

like that for exemple 

string  timeGMT = TimeToString(time_gmt,TIME_DATE|TIME_MINUTES|TIME_SECONDS);

 
Alain Verleyen #:

Also.

What is the delay to get the GMT from Internet this way ?

How do you know you will not have a X seconds delay for example, are you checking that in your code ?

im trying to to test it 

 
ALI AMRIOUI #:

yeah its work like a charm

thanks bro and GOD bless u inshallah

but how i can get value GMT directly  

like that for exemple 

string  timeGMT = TimeToString(time_gmt,TIME_DATE|TIME_MINUTES|TIME_SECONDS);

Yeah time_gmt has the value if you want to run comparisons and like you typed if you want to display 

 
Lorentzos Roussos #:
string  timeGMT = TimeToString(time_gmt,TIME_DATE|TIME_MINUTES|TIME_SECONDS);

string  timeGMT = TimeToString(time_gmt,TIME_DATE|TIME_MINUTES|TIME_SECONDS);


but i have error when i try to get the value  coz i wana use it  in the  difference between TimeCurrent and GMTtime

 
ALI AMRIOUI #:
string  timeGMT = TimeToString(time_gmt,TIME_DATE|TIME_MINUTES|TIME_SECONDS);

no its wrok goood.. im  sorry i have did mistake

thanks sir and GOD bless u inshalah

Reason: