Check how much time left to execute timer [duplicate] - delphi

This question already has answers here:
How do I check how much time remains before timer fires next event?
(5 answers)
Delphi Timer: Time before next event
(2 answers)
Closed 3 months ago.
I'm using Delphi 11.
Let's say you put a TTimer on your form and set interval to 60000. It will execute one minute from now.
But is there a way to check how much time is left to the Timer execute ? For instance, after 20 seconds passed, the Timer will run in 40 seconds. Is there any method i can check to get this value ?
Thanks

Related

Timer for an iOS game with 4 decimal places. My dev team says it's impossible [duplicate]

This question already has answers here:
What is the iOS equivalent of Java's System.nanoTime()?
(2 answers)
Closed 5 years ago.
My dev team is creating a game where the winner is timed up to 4 decimal places. So, for example, the winner completes a task in 13.9503 seconds. However, my developers told me that iOS only allows developers to track time up to 3 decimal places. Is this true or are there workarounds?
Thanks!
I would like to ask why you are using 4 decimal places, as if you are changing a UILabel 10000 times a second, I wouldn't recommend it, and if you aren't, well then a simple workaround is to use a 3 decimal place timer, and add a random number on the end. Although it sounds like a cheaty method of doing it, no human eye is going to pick up that the 4th decimal place is wrong.
For games your team should consider to use
func CACurrentMediaTime() -> CFTimeInterval,
milliseconds are fractional part of the result.
The number can later be formatted in NSDecimalNumber with fix representation of Decimal.

Windows Phone 8.1 - GeofenceState.Exited

I want to ask how is GeofenceState.Exited intended?
When I have a background task with GeofenceState.Entered, when I move inside the circle, I get IBackgroundTask.Run() run every 2 minutes (why 2 minutes?)
But with GeofenceState.Exited, I can walk miles, but it never gets triggered. Is there some bug, or is that intended differently than I suppose? I guess it should work this way: when the check is done after 2 minutes, when I'm outside of the circle, the method Run is called.
I have a parameter 50 and dwell time 1 sec.
Thanks

Countdown from current time, schedule

I want to have a countdown from the current time to a specific schedule like this:
8:48, 9:29, 11:56, 12:36, 13:18, and ect. and display that value in a label.
For example. Now we have 11:00 o'clock. And UILabel tell us 56 minutes remaining. And after 11:56 it tell us 40 minutes remaining (from current 11:56 to 12:36).
I don't ask you code directly, just help to find right way to search.
Thanks.
some links by searching google
Implementing a Countdown Timer in Objective-c?
http://looksok.wordpress.com/2012/12/29/ios-timer-countdown-implementation-tutorial-including-source-code/
and implementation
https://github.com/jonhernandez/iOS-Timer-Countdown
I havent looked at code quality, but it should get you started

timer function in Lua for a mobile app - "Closed" [duplicate]

This question already has an answer here:
Timed script/function in Lua
(1 answer)
Closed 9 years ago.
I am working on with Lua scripting language for a mobile app and have a requirement as follows -
The application's aim is to schedule appointments for an individual with a Doctor.
So once a user's appointment is scheduled, for e.g. 8th May # 4:30 PM, the user should receive a "reminder alert" before an hour i.e. # 3:30 PM.
I can get the user's date-time value and use the logic that a function should invoke just before 60 mins of that date-time. And that function contains my "Alert message".
But how to do this?
Can anyone guide me with a clue?
You're going to need:
Coroutines
os.excecute(sleep) or a sleep function like the one included in LuaSockets
You can find an example of using both here:
Creating a timer using Lua - 2nd answer

Execute action every x seconds delphi

I'm trying to execute a function(or procedure) every x seconds.
I've been looking everywhere but never seemed to find something that suits my needs.
My application basically gets data from the web and I want to make an auto-refresh checkbox.
So let's say the user checks the box, I want the app to call that function every 5 seconds.
Thanks!
Use a TTimer (from the System tab in the component palette). Set the interval to the number of seconds * 1000 (converting from milliseconds to seconds), and write a handler for the OnTimer event.
The simplest way it to use the TTimer component, part of Delphi's standard VCL. Put one on the form, make sure Enabled is set to True, set Interval to 5000 (the value is in milliseconds), and assign its OnTimer event, where you'll put the code that needs to run every 5 seconds.
Sometimes it is a good idea to start with the timer disabled, then set its Enabled property to true in code, so that the timer starts to fire after everything else in your application has been properly set up.
The timer may not be firing in exact 5-second intervals, since timer messages have low priority in Windows and may not be received if the CPU is doing a lot of other work. Since your interval is relatively long, you might set the timer to fire every second (Interval := 1000) or even a few times per second, and check current time every time it fires. Perform the update if current time is later by 5 seconds or more from the time of the last update. (Use the SecondsBetween function in DateUtils unit to make that determination).
I don't have Delphi at the moment, but I'm pretty sure there was a TTimer component in the control palette, and according to this, I think I'm right.

Resources