//+------------------------------------------------------------------------------------------------------------------+
//                                                                    \¦/                            [!!!-MT4 X-CLOCK]
//                                                                   (ò ó)
//______________________________________________________________o0o___(_)___o0o_______________________________________
#property copyright "Welcome to the World of Forex"
#property description "Let light shine out of darkness and illuminate your world"
#property indicator_chart_window
extern int     XPosition               =   -53;
extern int     YPosition               =   -14;
extern bool    ResetEveryHour          = false;
extern string  Note6                   = "Reset specified in Local Military Time";
extern string  Note7                   = "Trading Open is Eastern Time Zone";
extern string  Note8                   = "No adjust. for for Daylight Savings Time";
extern string  ResetOnTradingOpen      = "17:00";//  All times quoted are NYC time 
extern string  ResetOnLondonOpen       = "";//"07:00";//London Begins @ 08:00
extern string  ResetOnNYCOpen          = "";//"07:00";//NYC    Begins @ 08:00
extern string  ResetOnAsiaOpen         = "";//"08:00";//Tokyo  Begins @ 09:00
extern string  Note10                  = "For micro account, use suffix m or .fx";
extern string  ifmicro                 = "";
extern color   NegativePips            = C'255,110,20';
extern color   PositivePips            = DodgerBlue;
extern color   NeutralPips             = C'65,65,65';
bool    showbackgroundpanel     = false;

#define TradingOpen 0
#define LondonOpen 1
#define NYCOpen 2
#define AsiaOpen 3

int      OpenBar=9999,openbar[4];
int      WhatWindow   = 0;
int      WhatCorner   = 0;
color    PanelColor1  = C'144,144,144';
color    PanelColor2  = C'20,20,20';
datetime StartTime;            
string   buffername  = "MATRIX SESSION";  
           
string Symbols[];
int    SymbolsNumber,SymbolsIndex[][2], chartpair[2];
#define MajorsNumber 8
#define NZD 0//EUR 0
#define AUD 1//GBP 1
#define JPY 2//CHF 2
#define EUR 3//USD 3
#define GBP 4//CAD 4
#define CHF 5//NZD 5
#define USD 6//AUD 6
#define CAD 7//JPY 7
double SymbolsOpen[],SymbolsSorted[][2],Sorted[MajorsNumber][2],Pips[MajorsNumber][MajorsNumber],Tally[10];
string Majors[]  = {"NZD","AUD","JPY","EUR","GBP","CHF","USD","CAD"}; 
string space = "";            
color Colors[]={C'50,165,50',C'50,145,60', C'50,125,70',C'50,115,80',C'135,80,50',C'165,70,50',C'195,60,50',C'235,50,50'};

#import "kernel32.dll"
   void GetLocalTime(int& a0[]);
   void GetSystemTime(int& a0[]);
   int  GetTimeZoneInformation(int& a0[]);
   bool SystemTimeToTzSpecificLocalTime(int& a0[], int& a1[], int& a2[]);
#import

color opencolor = C'0,117,213', closecolor = C'150,34,34';
bool Highlight_Market_Open = TRUE;
bool Broker_MMSS_Is_Gold_Standard = TRUE;
bool Suppress_Bar_HH_Below_H1 = TRUE;
string TimeLondon,TimeAsia,TimeNYC;
bool Weekend_Test_Mode = FALSE;

int gia_216[43];
int gia_220[43];
int gia_224[43];
int gia_228[43];
int gia_232[43];
int gia_236[43];
int gia_240[43];
int gia_244[43];
int gia_248[43];

double g_ibuf_252[];
int gi_256 = 8;
int gi_260 = 17;
int gi_264 = 7;
int gi_268 = 16;
int g_datetime_272;

   int init(){
   IndicatorShortName("Currency Matrix"); 
   buffername= "CLOCK"; 
   if(ResetOnTradingOpen != "")  buffername  = buffername+"T";
   if(ResetOnLondonOpen != "")  buffername  = buffername+"L";
   if(ResetOnNYCOpen != "")  buffername  = buffername+"N";
   if(ResetOnAsiaOpen != "")  buffername  = buffername+"A";
   buffername=buffername+":";
       
   SymbolsNumber = createPairArray();
   ArrayResize(SymbolsOpen,SymbolsNumber);
   double work[][2]; ArrayResize(SymbolsSorted,SymbolsNumber);
   GetAllTimeZoneInfo(gia_216, gia_220, gia_224, gia_228, gia_232, gia_236, gia_240, gia_244, gia_248);
   Show_Panel(); return(0);}
      
   int deinit(){deleteObjects(); return(0);}

   int Reset_OpeningData(){
   static datetime LastTime;
    
   if(Time[0] == LastTime)       return(0);     // time already set for this hour 
   
   for(int row=1;row<10;row++) for(int col=0;col<10;col++){
      ObjectDelete(buffername+ "BR"+row+"C"+col);
      ObjectDelete(buffername+ "FR"+row+"C"+col);}
      
   if(ResetEveryHour && Time[0] != LastTime){
      LastTime=Time[0];
      for(int index=0;index<SymbolsNumber;index++) SymbolsOpen[index]=iOpen(Symbols[index],PERIOD_H1,0);
      return(1);}
   
   if(ResetOnTradingOpen != ""){
      openbar[TradingOpen]=StrToInteger(StringSubstr(TimeNYC,0,2))-StrToInteger(StringSubstr(ResetOnTradingOpen,0,2));
      if(openbar[TradingOpen]<0) openbar[TradingOpen]=24+openbar[TradingOpen];}  else openbar[TradingOpen]=999;
   
   if(ResetOnLondonOpen != ""){
      openbar[LondonOpen]=StrToInteger(StringSubstr(TimeLondon,0,2))-StrToInteger(StringSubstr(ResetOnLondonOpen,0,2));
      if(openbar[LondonOpen]<0) openbar[LondonOpen]=24+openbar[LondonOpen];}  else openbar[LondonOpen]=999;
   
   if(ResetOnNYCOpen != ""){
      openbar[NYCOpen]=StrToInteger(StringSubstr(TimeNYC,0,2))-StrToInteger(StringSubstr(ResetOnNYCOpen,0,2));
      if(openbar[NYCOpen]<0) openbar[NYCOpen]=24+openbar[NYCOpen];}  else openbar[NYCOpen]=999;
      
   if(ResetOnAsiaOpen != ""){
      openbar[AsiaOpen]=StrToInteger(StringSubstr(TimeAsia,0,2))-StrToInteger(StringSubstr(ResetOnAsiaOpen,0,2));
      if(openbar[AsiaOpen]<0) openbar[AsiaOpen]=24+openbar[AsiaOpen];}  else openbar[AsiaOpen]=999;
      
   for(int i=0;i<4;i++)  if(openbar[i]<OpenBar) OpenBar=openbar[i];   
   
   for(index=0;index<SymbolsNumber;index++) SymbolsOpen[index]=iOpen(Symbols[index],PERIOD_H1,OpenBar);
   LastTime=Time[0]; return(1);}
   
   int start(){
   int    index,counted_bars=IndicatorCounted(); 
    
   Clock();
   Reset_OpeningData();
   
   for(index=0;index<SymbolsNumber;index++){double DecNos=10000.;             
   if(SymbolsIndex[index,0] == JPY || SymbolsIndex[index,1] == JPY) DecNos=100.;
   double value=((iClose(Symbols[index],PERIOD_H1,0)-SymbolsOpen[index])*DecNos);
               
   Pips[SymbolsIndex[index,0],SymbolsIndex[index,1]]=-value;
   Pips[SymbolsIndex[index,1],SymbolsIndex[index,0]]=value;
   SymbolsSorted[index,0]=value;
   SymbolsSorted[index,1]=index;}
      
   Tally[NZD]=  Pips[EUR,NZD]+Pips[GBP,NZD]+Pips[NZD,CHF]-Pips[NZD,USD]+Pips[NZD,CAD]+Pips[AUD,NZD]-Pips[NZD,JPY]; 
   Tally[AUD]=  Pips[EUR,AUD]+Pips[GBP,AUD]-Pips[AUD,CHF]-Pips[AUD,USD]-Pips[AUD,CAD]-Pips[AUD,NZD]-Pips[AUD,JPY];
   Tally[JPY]=  Pips[EUR,JPY]+Pips[GBP,JPY]+Pips[CHF,JPY]+Pips[USD,JPY]+Pips[CAD,JPY]+Pips[AUD,JPY]+Pips[NZD,JPY];   
   Tally[EUR]=-(Pips[EUR,GBP]+Pips[EUR,CHF]+Pips[EUR,USD]+Pips[EUR,CAD]+Pips[EUR,NZD]+Pips[EUR,AUD]+Pips[EUR,JPY]);
   Tally[GBP]=  Pips[EUR,GBP]-Pips[GBP,CHF]-Pips[GBP,USD]-Pips[GBP,CAD]-Pips[GBP,NZD]-Pips[GBP,AUD]-Pips[GBP,JPY];
   Tally[CHF]=  Pips[EUR,CHF]+Pips[GBP,CHF]+Pips[USD,CHF]+Pips[CAD,CHF]+Pips[NZD,CHF]+Pips[AUD,CHF]-Pips[CHF,JPY];
   Tally[USD]=  Pips[EUR,USD]+Pips[GBP,USD]-Pips[USD,CHF]-Pips[USD,CAD]+Pips[NZD,USD]+Pips[AUD,USD]-Pips[USD,JPY];
   Tally[CAD]=  Pips[EUR,CAD]+Pips[GBP,CAD]-Pips[CAD,CHF]+Pips[USD,CAD]+Pips[NZD,CAD]+Pips[AUD,CAD]-Pips[CAD,JPY];
     
   for(int currency=0;currency<MajorsNumber;currency++){
   Sorted[currency,0]=Tally[currency]; Sorted[currency,1]=currency;}
  
   ArraySort(Sorted,WHOLE_ARRAY,0,MODE_DESCEND);
   for(currency=0;currency<MajorsNumber;currency++){ Print_Rows(currency);  Print_Totals(currency);}
   Print_HighLows();}
   
   void Print_Rows(int row){
   int index, xpos=17, ypos=68+17*row; index=Sorted[row,1];
   string sBbuffer=buffername+"BR"+(row+1)+"C",sFbuffer=buffername+"FR"+(row+1)+"C"; double value;
   
   xpos=17;
   //CreateBX1_Labels(sBbuffer+"0",xpos,  ypos,"ggg", 11, "Webdings",Colors[row]) ;
   //CreateBX1_Labels(sFbuffer+"0",xpos+4,ypos-1,Majors[index], 11, "Arial Black",White);
   xpos+=46;
   
   for(int col=0;col<MajorsNumber;col++){ value=Pips[index,col];
   if(value==0){
         ObjectDelete(sBbuffer+(col+1));
         ObjectDelete(sFbuffer+(col+1));}  else {
   if(value <= -12)       color Color=NegativePips; 
         else if (value >= 12)  Color=PositivePips;  
         else                   Color=NeutralPips;
   
   //CreateBX1_Labels(sBbuffer+(col+1),xpos,ypos,"ggg",11,"Webdings",Color);
   //Values
   //SetTextRight(sFbuffer+(col+1),xpos+41,ypos+2,Set_Text(DoubleToStr(value,0)),10,"Arial Black",White);
   }
   xpos+=46;}
      
   //CreateBX1_Labels(sBbuffer+"9",xpos,ypos,"ggg",11,"Webdings",Colors[row]);
   //Tally in Ascending Order
   //SetTextRight(sFbuffer+"9",xpos+41,ypos+2,Set_Text(DoubleToStr(Tally[index],0)),10,"Arial Black",White);
   }
   
   string Set_Text(string text){ switch(StringLen(text)){
      case 1:  text="      "+text; break; 
      case 2:  text="     " +text; break;
      case 3:  text="   "   +text; break;
      case 4:  text="  "    +text; break;}  return(text);}
            
   void Print_Totals(int col){ int offset=63+col*46;
   for(int index=0;index<MajorsNumber;index++) if(col==Sorted[index,1]) break;
   col+=1;
   //CreateBX1_Labels(buffername+"BR9C"+col,offset,204,"ggg",11,"Webdings",Colors[index]);
   //SetTextRight(buffername+"FR9C"+col,offset+41,206,Set_Text(DoubleToStr(Tally[col-1],0)),10,"Arial Black",White);   
   //CreateBX1_Labels(buffername+"BR0C"+col,offset,51,"ggg",11,"Webdings",Colors[index]);
   //CreateBX1_Labels(buffername+"FR0C"+col,offset+4,50,Majors[col-1],11,"Arial Black",White);
   }
   
   void Print_HighLows(){ ArraySort(SymbolsSorted,WHOLE_ARRAY,0,MODE_DESCEND);
   
   int xpos=477,index,ypos=68,nbr=0,row;
   for(int roww=0;roww<8;roww++){ row=roww;
   if(row>3) row=SymbolsNumber-8+roww;
   //CreateBX1_Labels(buffername+"QanelA"+roww,xpos,  ypos,"gggg",11,"Webdings",Colors[roww]);
   //CreateBX1_Labels(buffername+"QanelB"+roww,xpos+8,ypos,"gggg",11,"Webdings",Colors[roww]);
   index=SymbolsSorted[row,1];
      
   ObjectDelete(buffername+"QanelC"+roww); 
   if(SymbolsSorted[row,0]>=12 || SymbolsSorted[row,0]<=-12)
   //Symbols in ascending order
   //CreateBX1_Labels(buffername+"QanelC"+roww,xpos+4,ypos+2,Symbols[index],10,"Arial Black",White);
   nbr+=4; ypos+=17;}}
                 
   int createPairArray(){ string symbol; int index=0;
   for(int base=0;base<MajorsNumber-1;base++){
   for(int counter=base+1; counter<MajorsNumber; counter++){
   symbol=Majors[base]+Majors[counter]+ifmicro;
   if(MarketInfo(symbol,MODE_BID)>0.0){
   ArrayResize(Symbols,index+1);
   Symbols[index]=symbol;
   ArrayResize(SymbolsIndex,index+1);
   SymbolsIndex[index,0]=base;
   SymbolsIndex[index,1]=counter;
   index++;}
           
   symbol=Majors[counter]+Majors[base]+ifmicro;
   if(MarketInfo(symbol,MODE_BID)>0.0){
   ArrayResize(Symbols,index+1);
   Symbols[index]=symbol;
   ArrayResize(SymbolsIndex,index+1);
   SymbolsIndex[index,0]=counter;
   SymbolsIndex[index,1]=base;
   index++;}}}
   
   GetLastError(); return(ArraySize(Symbols));}   
   
   void SetTextRight(string name,int x,int y,string Text,int FontSize,string Font,color Color){
   //name=Version+" "+name;
    if(ObjectCreate(0,name,OBJ_LABEL,WhatWindow,0,0)) {
   ObjectSetInteger(0,name,OBJPROP_CORNER,WhatCorner);
   ObjectSetInteger(0,name,OBJPROP_ANCHOR,ANCHOR_RIGHT_UPPER);}
   ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x+XPosition);
   ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y+YPosition);
        ObjectSetText(name,Text,FontSize,Font,Color);}
   
   int CreateBX1_Labels(string K,int x,int y,string Text,int FontSize,string Font,color Color){
    ObjectCreate(K,OBJ_LABEL,WhatWindow,0,0);
       ObjectSet(K,OBJPROP_CORNER,WhatCorner);
       ObjectSet(K,OBJPROP_XDISTANCE,x+XPosition);
       ObjectSet(K,OBJPROP_YDISTANCE,y+YPosition);
       ObjectSet(K,OBJPROP_BACK,false);
   ObjectSetText(K,Text,FontSize,Font,Color);}   
        
   void deleteObjects(){ int i;
   for(i=0;i<28;i++)  ObjectDelete(buffername+"Panel"+i);
   for(i=0; i<8;i++)  ObjectDelete(buffername+"HighLowB"+i);
   for(i=0; i<8;i++)  ObjectDelete(buffername+"QanelA"+i);
   for(i=0; i<8;i++)  ObjectDelete(buffername+"QanelB"+i);
   for(i=0; i<8;i++)  ObjectDelete(buffername+"QanelC"+i);
   for(int row=0;row<10;row++) for(int col=0;col<10;col++){
      ObjectDelete(buffername+"BR"+row+"C"+col);
      ObjectDelete(buffername+"FR"+row+"C"+col);} GetLastError();}
   
   void Show_Panel(){   
   if(showbackgroundpanel){    
   CreateBX1_Labels(buffername+"Panel1",59,32,   "gg",20,"Webdings",PanelColor1);
   CreateBX1_Labels(buffername+"Panel2",194,32,  "gg",20,"Webdings",PanelColor1);
   //CreateBX1_Labels(buffername+"Panel3",13,67,   "gg",90,"Webdings",PanelColor1);
   //CreateBX1_Labels(buffername+"Panel4",13,89,   "gg",90,"Webdings",PanelColor1);
   //CreateBX1_Labels(buffername+"Panel5",59,106,  "gg",90,"Webdings",PanelColor1);
   //CreateBX1_Labels(buffername+"Panel6",194,106, "gg",90,"Webdings",PanelColor1);
   //CreateBX1_Labels(buffername+"Panel7",309,67,  "gg",90,"Webdings",PanelColor1);
   //CreateBX1_Labels(buffername+"Panel8",309,89,  "gg",90,"Webdings",PanelColor1);
//+---  
   CreateBX1_Labels(buffername+"Panel9",61,34,   "gg",20,"Webdings",PanelColor2);
   CreateBX1_Labels(buffername+"Panel10",192,34, "gg",20,"Webdings",PanelColor2); 
   //CreateBX1_Labels(buffername+"Panel11",15,69,  "gg",90,"Webdings",PanelColor2);
   //CreateBX1_Labels(buffername+"Panel12",15,87,  "gg",90,"Webdings",PanelColor2);
   //CreateBX1_Labels(buffername+"Panel13",61,104, "gg",90,"Webdings",PanelColor2);
   //CreateBX1_Labels(buffername+"Panel14",192,104,"gg",90,"Webdings",PanelColor2);
   //CreateBX1_Labels(buffername+"Panel15",307,69, "gg",90,"Webdings",PanelColor2);
   //CreateBX1_Labels(buffername+"Panel16",307,87, "gg",90,"Webdings",PanelColor2);
   }}
   
   int Clock(){
   int lia_0[4];
   int lia_4[4];
   int lia_8[4];
   int lia_12[4];
   int lia_16[4];
   int li_40;
   int li_48;
  
   int NYTime,LondonTime,TokyoTime;
   string l_text_88;
   
   int li_176;
   string l_time2str_180;
   if(!IsDllsAllowed()){
   if(TimeCurrent()-g_datetime_272>=7){ g_datetime_272=TimeCurrent();
   Alert(WindowExpertName(),": ERROR. DLLs are disabled. To enable, select \'Allow DLL Imports\' in the Common Tab of indicator");}}
   else { if(!Weekend_Test_Mode && TimeCurrent()-g_datetime_272==0) return(0);///*****///
   g_datetime_272=TimeCurrent();
   GetLocalTime(lia_0);
   li_40 = TimeArrayToTime(lia_0);
   int CurrentTime = TimeCurrent();
   li_48=0;
   if(Broker_MMSS_Is_Gold_Standard && !Weekend_Test_Mode){
   li_48=60*TimeMinute(CurrentTime)+TimeSeconds(CurrentTime)-60*TimeMinute(li_40)-TimeSeconds(li_40);
   if(li_48>1800) li_48-=3600;  else  if(li_48<-1800) li_48+=3600;}
   GetSystemTime(lia_4);
      
   SystemTimeToTzSpecificLocalTime(gia_220, lia_4, lia_8);
   NYTime = TimeArrayToTime(lia_8) + li_48;
   SystemTimeToTzSpecificLocalTime(gia_224, lia_4, lia_12);
   LondonTime = TimeArrayToTime(lia_12) + li_48;
   SystemTimeToTzSpecificLocalTime(gia_228, lia_4, lia_16);
   TokyoTime = TimeArrayToTime(lia_16) + li_48;       
      
   TimeLondon=TimeToString(LondonTime,true);
     TimeAsia=TimeToString(TokyoTime,true);
      TimeNYC=TimeToString(NYTime,true);
            
   li_176=60*Period()+Time[0]-TimeCurrent();
   if(li_176>=0){ l_time2str_180=TimeToStr(60*Period()+Time[0]-TimeCurrent(),TIME_MINUTES);
   if(Suppress_Bar_HH_Below_H1 && Period()<=PERIOD_H1 && StringLen(l_time2str_180)>6) l_time2str_180=
      StringSubstr(l_time2str_180,3);} 
          
   color ctimes[3]; for(int i=0;i<3;i++) ctimes[i]=closecolor;
      
   if(TimeDayOfWeek(TokyoTime)!=0 && TimeDayOfWeek(TokyoTime)!=8 && Highlight_Market_Open && TimeHour(TokyoTime)
   >=gi_256 && TimeHour(TokyoTime)<gi_260) ctimes[2]=opencolor;
      
   if(TimeDayOfWeek(LondonTime)!=0 && TimeDayOfWeek(LondonTime)!=8 && Highlight_Market_Open && TimeHour(LondonTime)
   >=gi_256 && TimeHour(LondonTime)<gi_260) ctimes[0]=opencolor;
      
   if(TimeDayOfWeek(NYTime)!=0 && TimeDayOfWeek(NYTime)!=8 && Highlight_Market_Open && TimeHour(NYTime)
   >=gi_256 && TimeHour(NYTime)<gi_260) ctimes[1]=opencolor;}
   
   CreateBX1_Labels(buffername+"Panel17", 63,34,"ggggg",12,"Webdings",ctimes[2]);
   CreateBX1_Labels(buffername+"Panel18",136,34,"gggg" ,12,"Webdings",ctimes[2]);
   CreateBX1_Labels(buffername+"Panel19",201,34,"ggggg",12,"Webdings",ctimes[0]);
   CreateBX1_Labels(buffername+"Panel20",274,34,"gggg" ,12,"Webdings",ctimes[0]);
   CreateBX1_Labels(buffername+"Panel21",339,34,"gggg" ,12,"Webdings",ctimes[1]);
   CreateBX1_Labels(buffername+"Panel22",382,34,"ggg"  ,12,"Webdings",ctimes[1]);
   
   CreateBX1_Labels(buffername+"Panel23",208,35," LONDON                   NY ",10,"Arial Black",clrSnow);
   CreateBX1_Labels(buffername+"Panel24",75,35," TOKYO ",10,"Arial Black",clrSnow);
   CreateBX1_Labels(buffername+"Panel25",285,35,TimeLondon,10,"Arial Black",White);
   CreateBX1_Labels(buffername+"Panel26",380,35,TimeNYC,   10,"Arial Black",White);
   CreateBX1_Labels(buffername+"Panel27",145,35,TimeAsia,  10,"Arial Black",White);  return(0);}

   string TimeToString(int theTime,bool MilitaryTime){ string Return;
   int hour=TimeHour(theTime);
   
   if(!MilitaryTime && (hour>12 || hour==0)) Return=TimeToStr(theTime-43200,TIME_MINUTES);
   else Return=TimeToStr(theTime,TIME_MINUTES);
   
   if(!MilitaryTime){
   if(hour>=12)  Return=StringConcatenate(Return," PM");
      else       Return=StringConcatenate(Return," AM");}  return(Return);}

   string FormatDateTime(int theTime, int ai_4, int ai_8, int ai_12, int ai_16, int ai_20) {
   string ls_24 = ai_4 + 100;
   ls_24 = StringSubstr(ls_24, 1);
   string ls_32 = ai_8 + 100;
   ls_32 = StringSubstr(ls_32, 1);
   string ls_40 = ai_12 + 100;
   ls_40 = StringSubstr(ls_40, 1);
   string ls_48 = ai_16 + 100;
   ls_48 = StringSubstr(ls_48, 1);
   string ls_56 = ai_20 + 100;
   ls_56 = StringSubstr(ls_56, 1);
   return (StringConcatenate(theTime,".",ls_24,".",ls_32," ",ls_40,":",ls_48,":",ls_56));}

   int TimeArrayToTime(int aia_0[4]){ int l_str2time_44;
   int li_4 = aia_0[0] & 65535;
   int li_8 = aia_0[0] >> 16;
   int li_16 = aia_0[1] >> 16;
   int li_20 = aia_0[2] & 65535;
   int li_24 = aia_0[2] >> 16;
   int li_28 = aia_0[3] & 65535;
   int li_32 = aia_0[3] >> 16;
   string ls_36 = FormatDateTime(li_4, li_8, li_16, li_20, li_24, li_28);
   l_str2time_44 = StrToTime(ls_36);  return(l_str2time_44);}

   void GetAllTimeZoneInfo(int aia_0[43],int &aia_4[43],int &aia_8[43],int &aia_12[43],int &aia_16[43],
   int &aia_20[43],int &aia_24[43], int &aia_28[43],int &aia_32[43]){
   int li_36 = GetTimeZoneInformation(aia_0);
   aia_4[0] = 300;
   aia_4[17] = 720896;
   aia_4[18] = 65536;
   aia_4[19] = 2;
   aia_4[20] = 0;
   aia_4[21] = 0;
   aia_4[38] = 196608;
   aia_4[39] = 131072;
   aia_4[40] = 2;
   aia_4[41] = 0;
   aia_4[42] = -60;
   aia_8[0] = 0;
   aia_8[17] = 655360;
   aia_8[18] = 327680;
   aia_8[19] = 2;
   aia_8[20] = 0;
   aia_8[21] = 0;
   aia_8[38] = 196608;
   aia_8[39] = 327680;
   aia_8[40] = 1;
   aia_8[41] = 0;
   aia_8[42] = -60;
   aia_12[0] = -540;
   aia_12[17] = 0;
   aia_12[18] = 0;
   aia_12[19] = 0;
   aia_12[20] = 0;
   aia_12[21] = 0;
   aia_12[38] = 0;
   aia_12[39] = 0;
   aia_12[40] = 0;
   aia_12[41] = 0;
   aia_12[42] = 0;
   aia_16[0] = -600;
   aia_16[17] = 262144;
   aia_16[18] = 65536;
   aia_16[19] = 3;
   aia_16[20] = 0;
   aia_16[21] = 0;
   aia_16[38] = 655360;
   aia_16[39] = 65536;
   aia_16[40] = 2;
   aia_16[41] = 0;
   aia_16[42] = -60;
   aia_20[0] = -720;
   aia_20[17] = 262144;
   aia_20[18] = 65536;
   aia_20[19] = 3;
   aia_20[20] = 0;
   aia_20[21] = 0;
   aia_20[38] = 589824;
   aia_20[39] = 327680;
   aia_20[40] = 2;
   aia_20[41] = 0;
   aia_20[42] = -60;
   ArrayCopy(aia_24, aia_8);
   aia_24[0] = -180;
   ArrayCopy(aia_28, aia_8);
   aia_28[0] = -60;
   ArrayCopy(aia_32, aia_4);
   aia_32[0] = 480;}