kibbitzer
16 May 09, 07:52 PM
G'day All,
I'm trying to display, in a CTC control (written to by a user defined System I/O variable), the AMOUNT of time, expressed in minutes and seconds (and optionally, hours) until sunrise, sunset or a particular time of day. At this satge, I only wish to have a maximum of 60 minutes maximum before the event (hours seem to be a lot more difficult).
global variables:
intTime2event := integer
strTime2event := string
Module:
{*********** start of code **************}
begin
intTime2event := sunset - "01:00:00" - time; {one hour before the event: sunset}
TimeToString(intTime2event, strTime2event);
SetStringSystemIO("Time to Event", strTime2event);
{Delay(60); in case I want to refresh the display once a minute}
end;
{*********** end of code **************}
This results in a 'time of day' displaying. The minutes count down correctly, but the 12H and AM are unwanted.
Is there a way to truncate/extract the string so that only the minutes and seconds portion of the string are written to the variable?
or...
Can I get around this by somehow initialising and starting a timer, set by schedule, at a particular time and displaying the results?... I know that timers only count UP... so I'm in the dark! (not very punny!)
Regards,
Peter.
I'm trying to display, in a CTC control (written to by a user defined System I/O variable), the AMOUNT of time, expressed in minutes and seconds (and optionally, hours) until sunrise, sunset or a particular time of day. At this satge, I only wish to have a maximum of 60 minutes maximum before the event (hours seem to be a lot more difficult).
global variables:
intTime2event := integer
strTime2event := string
Module:
{*********** start of code **************}
begin
intTime2event := sunset - "01:00:00" - time; {one hour before the event: sunset}
TimeToString(intTime2event, strTime2event);
SetStringSystemIO("Time to Event", strTime2event);
{Delay(60); in case I want to refresh the display once a minute}
end;
{*********** end of code **************}
This results in a 'time of day' displaying. The minutes count down correctly, but the 12H and AM are unwanted.
Is there a way to truncate/extract the string so that only the minutes and seconds portion of the string are written to the variable?
or...
Can I get around this by somehow initialising and starting a timer, set by schedule, at a particular time and displaying the results?... I know that timers only count UP... so I'm in the dark! (not very punny!)
Regards,
Peter.