int func_返回时区(){
int result = 0;
//Print( "是否休市=", func_是否在休市中() );
if ( func_是否在休市中() ){
int myHour = TimeHour( iTime( NULL,PERIOD_H1,0) );
result = 24-myHour;
}else {
datetime 时间差 = TimeCurrent() - TimeGMT();
if ( 时间差 >= (3600 * 3 -20) && 时间差 < (3600 * 3 + 20 ) ) {
result = 3;
}else if (时间差 >= (3600 * 2 -20) && 时间差 < (3600 * 2 + 20) ){
result = 2;
}else if (时间差 >= (3600 * 0 -20) && 时间差 < (3600 * 0 + 20) ) {
result = 0;
}else if (时间差 >= (3600 * 1 -20) && 时间差 < (3600 * 1 + 20) ) {
result = 1;
}else if (时间差 >= (3600 * 4 -20) && 时间差 < (3600 * 4 + 20) ){
result = 4;
}else if (时间差 >= (3600 * 5 -20) && 时间差 < (3600 * 5 + 20) ) {
result = 5;
}else if (时间差 >= (3600 * 6 -20) && 时间差 < (3600 * 6 + 20) ){
result = 6;
}else if (时间差 >= (3600 * 7 -20) && 时间差 < (3600 * 7 + 20) ) {
result = 7;
}
}
return(result);
} |