kimi18 Posted November 28, 2011 Share Posted November 28, 2011 Hello Sorry my bad english This is my script, but not good program New; var myDate: TDateTime; myVmi: double; myTime: string; begin repeat myDate := Time; myTime := FormatDateTime('tt', myDate); Status('It is now '+myTime); wait(1000); writeln(myTime); until (myTime = '06:20:25'); end. I need script, that stop example when the time 06:20:25. This script dont stop 06:20:25, but why? Thanks help. Quote Link to comment Share on other sites More sharing options...
wyn10 Posted December 19, 2011 Share Posted December 19, 2011 In until (myTime = '06:20:25'); You need to add AM or PM, as in the Writeln it's outputting that also. Example... until (myTime = '1:39:55 PM'); Have fun. Quote Link to comment Share on other sites More sharing options...
Wanted Posted December 20, 2011 Share Posted December 20, 2011 It's very possible for it to skip a second or something when it gets to the end of loop, not a reliable way to do that. Quote Link to comment Share on other sites More sharing options...
wyn10 Posted December 20, 2011 Share Posted December 20, 2011 It's very possible for it to skip a second or something when it gets to the end of loop, not a reliable way to do that. Not really cause it's outputting every second. And I had this run for a good 20mins. Quote Link to comment Share on other sites More sharing options...
Wanted Posted December 20, 2011 Share Posted December 20, 2011 Not really cause it's outputting every second. And I had this run for a good 20mins. Nothing is ever exact. You never want to use =, instead >= if possible. Strings are not the right type for this. It is very easy for it to never be the correct string at the correct time it is checked at the end of the loop. Quote Link to comment Share on other sites More sharing options...
wyn10 Posted December 20, 2011 Share Posted December 20, 2011 Nothing is ever exact. You never want to use =, instead >= if possible. Strings are not the right type for this. It is very easy for it to never be the correct string at the correct time it is checked at the end of the loop. . It didn't seem like it was needed. Quote Link to comment Share on other sites More sharing options...
Wanted Posted December 20, 2011 Share Posted December 20, 2011 So in the high chance that it doesn't check that exact time at the end of that loop it will repeat forever, an even higher chance considering a loop is brought back up multiple times. Especially if it wasn't something simple like this that had more stuff in the loop the would greatly affect the time. This is horrible practice and should never be used regardless of the situation, this is exactly how intermittent problems happen. Quote Link to comment Share on other sites More sharing options...
wyn10 Posted December 20, 2011 Share Posted December 20, 2011 So in the high chance that it doesn't check that exact time at the end of that loop it will repeat forever, an even higher chance considering a loop is brought back up multiple times. Especially if it wasn't something simple like this that had more stuff in the loop the would greatly affect the time. This is horrible practice and should never be used regardless of the situation, this is exactly how intermittent problems happen. I was only solving his issue. A simple "if" could be added though so that doesn't happen. The only high chance would be if a hour went back/forward. Which he could have noticed himself. Quote Link to comment Share on other sites More sharing options...