function sleep alternative - page 4

 

Simon,


10 = ( (10000+10) - (10000) );


Difference is ten.


Thank you

 
WhooDoo22:

Simon,

10 = ( (10000+10) - (10000) );

Difference is ten.

Nope.  Well it might be, but the reason that you have shown above shows that your reasoning is wrong.  You need to read the documentation again TimeSeconds()  ad when you have read this too  TimeHour()  and this  TimeMinute()  then have a think about a datetime of 12:33:21  and what each of these functions will return for that datetime.  
 

Simon,

Are you saying my format of '10' is wrong? If so, I could make a quick adjustment from '10' to '00:00:10'.

What say you to this?


Thank you

 
WhooDoo22:

Simon,

Are you saying my format of '10' is wrong? If so, I could make a quick adjustment from '10' to '00:00:10'.

Nope.  Did you read the documentation that I linked to ?

 

Lets take my example,  12:33:21

TimeHour()   "Returns the hour for the specified time."  so will return  12 for a datetime of 12:33:21

TimeMinute()   "Returns the minute for the specified time."     so will return  33  for a datetime of 12:33:21

TimeSeconds()   "Returns the amount of seconds elapsed from the beginning of the minute for the specified time."      so will return  21  for a datetime of 12:33:21

 

Do you know what a datetime  is ?  you know what the relevance of 1970 is ?  good.

SomeTime = 10000  when is this ? lets find out,  10000 seconds is 2.777 hours so it is 2 am,  0.77777 hours is 46.6666 mins,  so that is 46 mins past 2 am,  and 0.6666 mins is 40 seconds.  So a datetime of 10000 is  1st January 1970  01:46:40  and 10000 + 10 is  01:46:50  so for this example your answer of 10 was correct,  but for the wrong reason.

If my example was 10000 and 10000 + 30  your answer would have been 30,  but these datetime would have been 1st Jan 1970 01:46:40 and  01:47:10,  the correct answer would have been 10 - 30 = -20 not 30 

 

Simon,

Did you read the documentation that I linked to ?

Yes.


Do you know what a datetime  is ?

datetime is a datatype.


you know what the relevance of 1970 is ?

I'm guessing in this case one thousand, nine hundred and seventy seconds?


your answer of 10 was correct,  but for the wrong reason.

I believe I understand Simon. You've made your point. Thank you for your explanation.


Also, I believe your explanation has allowed me to discover a solution from not being able to pause time in tester to being able to pause time in tester.

I might possibly be able to use a cycle to run on a predetermined time. When the time runs down to a lesser chosen time, the lesser chosen time will be reset and the cycle will continue endlessly UNLESS, this time is still run based on ticks. Ticks are becoming a real nuisance for me.


Maybe I can find a way to start the EA without waiting for ticks. I can use an 'if' condition to trigger the start() function.

What say you to this?


I added this code in SRC

bool start;
   
if(start==false)start();

to an EA and received an error named "stack overflow" from the journal in tester.


Thank you

 
WhooDoo22:

Do you know what a datetime  is ?

datetime is a datatype.


you know what the relevance of 1970 is ?

I'm guessing in this case one thousand, nine hundred and seventy seconds?


WhooDoo22:


I might possibly be able to use a cycle to run on a predetermined time. When the time runs down to a lesser chosen time, the lesser chosen time will be reset and the cycle will continue endlessly UNLESS, this time is still run based on ticks. Ticks are becoming a real nuisance for me.


 It is clear from these statements that you either are not reading what is written to help you or that you simply cannot understand it.  As you have given no indication that you are not able to understand I can only conclude that you are not trying to comprehend what is written.  That being the case I won't take any more of your time trying to help. 

Reason: