2 // control/data/texttime.qc
4 float() _IDLTT_ConvertTime =
8 local float lCount, lCounter;
12 lCount = tokenize( self.value );
13 for( lCounter = 0; lCounter < lCount; ++lCounter ) {
14 lCurrent = stof( argv( lCounter ) );
15 lTotal = lTotal * 60 + lCurrent;
17 if( argv( ++lCounter ) != ":" )
20 return rint( lTotal );
23 string() _IDLTT_MakeString =
29 lTotal = rint( self._realValue );
32 lCurrent = mod( lTotal, 60 );
35 lString = String_Zone( ftos( lCurrent ) );
37 lString = String_Set( lString, strcat( ftos( lCurrent ), ":", lString ) );
39 lTotal = floor( lTotal / 60 );
45 void( float pEvent ) Item_DataLink_TextTime_DataEvent =
47 Item_DataLink_Update();
49 if( pEvent == ITEM_DATALINK_SET ) {
50 self._link._realValue = _IDLTT_ConvertTime();
51 Raise_DataEvent( self._link, ITEM_DATALINK_SET );
52 self._realValue = self._link._realValue;
53 } else if( !self._link )
55 else if( pEvent == ITEM_DATALINK_GET ) {
56 Raise_DataEvent( self._link, ITEM_DATALINK_GET );
57 if( self._link._realValue != self._realValue ) {
58 self._realValue = self._link._realValue;
59 String_EntitySet( self, value, String_Normal( _IDLTT_MakeString() ) );
62 Raise_DataEvent( self._link, pEvent );
63 self._realValue = self._link._realValue;
64 String_EntitySet( self, value, String_Normal( _IDLTT_MakeString() ) );
68 void() Item_DataLink_TextTime_Spawn =
72 self._dataEvent = Item_DataLink_TextTime_DataEvent;
73 self._realValue = self._link.minValue - 1;