I'm trying to make a countdown in Swift which do not rely on any specific time, but a time interval i choose. For an example i want the countdown from 100-99 to take approximately 4 hours. Is that possible in any way?
You can use NSTimer to run a specific task after a given time and specify whether or not you want it to repeat itself. The method you're looking for is most likely scheduledTimerWithTimeInterval. For an example, please look at this post.
For more informations, please look at Apple's NSTimer Class Reference and especially section titled Scheduling Timers in Run Loops.
Related
Im trying to get the time in a assembler in anylogic, I can use measuretimestart/end features for the services and I can get the distribution graphs, however when I try to get the time for the assembler with the following code: On enter 3: Time=time(); and On exit: timeDS.add(time()-Time); the mean doesn't make sense to me. I really don't know at this stage what element is providing a realistic information in the software.
I'm testing with a 10 weeks delay time each block and no delays in the queues, even removing the selectOutput function. the arrival is a rate of 1 per month, triggering a calls for inject 1 element each, but I wet this non sense mean every time, is there any code to use in this particular situations or how I get the distributions correct?
Thanks!
enter image description here
what are you trying to measure: the time it takes for the assembly to happen? The time it takes from the moment the first part of the assembly arrives until the assembly happens? This answer is only associated to the delay time.
Time seems to be a global variable, so if many assemblies are happening at the same time, your result will be distorted because Time variable changes every time an assembly starts...
Also, the on enter 3 is not what defines the moment in which the assembly process starts. Instead use the "on enter delay" action
you need to define an agent type that will be at the output of the assembler and assign it a time variable then on the "on enter delay" you can do agent.startTime=time() and the "on at exit" you can do "data.add(time()-agent.startTime)
In my automated test I have an area that occasionally shows up (and needs to be clicked on when it does show up). This is the perfect place to use an OptionalStep prefix, to prevent the step from failing if the optional area never shows up.
Thing is, I would like the OptionalStep to only wait a second or two before moving on to the rest of the test. Just as I can have object.Exist(2) only wait for 2 seconds, is there a way to have OptionalStep wait for only a couple of seconds?
Some other caveats:
I'd like to keep this as one small line. I know I could create a
multi-line logic test that uses object.Exist(2) inside an If/Then
statement, but I'd rather have the code be small and trim.
I don't want to change the global 20 second timeout just for this one
step.
Since this optional step only shows up in one specific area, it seems
like Recovery Scenarios would not be a good choice to have running
throughout the entire test.
Vitaly's comment would be a good solution as you are possibly unnecessarily over complicating your test.
Also having such a long global timeout is not recommended and should be as low as possible. I usually have it set at around 3 seconds and deal with the synchronisation in the code.
Anything that takes a long period of time should be known about upfront and dealt with in the code. Having a global timeout for everything will cause your test to run unnecessarily slow when most object cannot be found errors occur.
I wonder how can I setup the time profiler instrument to show me the calls that are done between a period of time. I don't want it to show me all the calls of running time.
Is this possible?
I've been trying with flags but no see anything to change.
Basically I want to focus on a certain peak.
Option-drag on the timeline in instruments to just include results from that time range. Simple as that, really.
There is no way (that I'm aware of anyway) to trigger arbitrary flags in Instruments from user code. I've come up with a couple of alternatives.
The simplest one I've found is to put a call to sleep(1) right before and right after the stuff I want to look at, this means that I can easily identify a period of total idle right before and after the zone of interest. Crude, but effective.
The other alternative is that you can use Instruments' custom instrument mechanism to instrument certain calls. This can, similarly, give you other items on the timeline that you can use for reference. These can be challenging to create and get just right, so most often I just use the cruder method described above.
HTH
Not sure when this changed, but in Xcode 11, Option-dragging only performs a zoom. It doesn't change the range of reported data. Cmd-dragging does nothing. The key is to just drag across the range, but do it in the content region of the Time Profiler plot area - NOT the "time bar" at the top.
I am writing a Scheduling type application in C#, and allowing the user to store tasks that they want to run at certain times. Right now I give them the option of specifying how often to run it (Daily/Weekly/Monthly) as well as specify a time, which is then stored in a Database.
I am having a little bit of trouble just wrapping my head around the pseudo code behind this, and am looking for some suggestions about how to implement it. I am running a repeating timer every 60 seconds to check each task to see if it needs to run, but always seem to hit road blocks when I need to work with Date/Time and adding Recurring Day (daily/weekly/etc) has complicated it even more.
I need to be able to create recurring events that happen on specific days but don't necessarily happen every week. They could be scheduled bi-weekly, every 3 weeks, etc. There is a current implementation that needs an update and I'd like to use the temporal expressions stuff from runt to redo it.
Runt will work for what I need except it doesn't seem to handle the intervals for non-weekly events. It adds some complexity because the event also needs to capture a start date so you can accurately compute which weeks to fire the events and which to ignore them. I think I can rework runt to do this, but I'd rather not reinvent the wheel if somebody has already tackled it, or there is a better solution out there. Any suggestions?
You aren't clear, are you running a script continiously to do this? If so why not use something like "at".
If this is a scheduling application have you looked at:
http://icalendar.rubyforge.org/
I've decided to build what I needed into runt. I've got the initial support already in (in the way of a REWeekWithIntervalTE class that takes a start date, interval, and weekday or array of weekdays). If anybody is interested in playing with it you can check out my fork. Sorry for not being more clear in my initial question about it being a scheduling issue.