_SECTION_BEGIN("Time Left");
function GetSecondNum()
{
Time = Now( 4 );
Seconds = int( Time % 100 );
Minutes = int( Time / 100 % 100 );
Hours = int( Time / 10000 % 100 );
SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
return SecondNum;
}
//RequestTimedRefresh( 1 );
TimeFrame = Interval();
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;
x=Param("xposn",1,0,1200,1);
y=Param("yposn",430,0,1000,1);
//GfxSelectSolidBrush( ColorRGB( 230, 230, 230 ) );
//GfxSelectPen( ColorRGB( 230, 230, 230 ), 2 );
if ( NewPeriod )
{
//GfxSelectSolidBrush( colorYellow );
//GfxSelectPen( colorBlue, 2 );
Say( "New period" );
}
//GfxRoundRect( x+45, y+40, x-3, y-2, 0, 0 );
//File: TimeLeft in Bar
//Sept 20, 2005
// Compute Time Left In Bar
//
BarTime1 = LastValue(TimeNum() - Now(4));
DataError = IIf(Now(4) > TimeNum(),True,False);
TimeBase = IIf(Interval(1)>0,1,0);
_N(StrBarTime = NumToStr(BarTime1,1.0,False));
BT_Length = StrLen(StrBarTime);
_N(TimeLeft_ =
WriteIf(BT_Length==1,"0:0"+StrBarTime,WriteIf(BT_Length==2,"0:"+StrBarTime,
WriteIf(BT_Length==3,StrLeft(StrBarTime,1)+":"+StrRight(StrBarTime,2),
StrLeft(StrBarTime,2)+":"+StrRight(StrBarTime,2)))));
TimeLeft = WriteIf(TimeBase==1,TimeLeft_,"N/A");
GfxSetBkMode(2);
GfxSetBkColor( colorBlack );
GfxSelectFont( "Arial", 14, 700, False );
GfxSetTextColor( ParamColor("ColorTimeLeft",colorGold ));
GfxTextOut("Time Left :"+SecsToGo+"", x, y );
GfxTextOut( Now(2)+ " " + TimeLeft, x, y-18 );
_SECTION_END();