Questions tagged [system-clock]
130 questions
3
votes
4 answers
How to increase sleep/pause timing accuracy in python?
I ran an experiment to compare sleep/pause timing accuracy in python and C++
Experiment summary:
In a loop of 1000000 iterations, sleep 1 microsecond in each iteration.
Expected duration: 1.000000 second (for 100% accurate program)
In python:
import…

Ahmed Hussein
- 715
- 1
- 15
- 38
3
votes
2 answers
What is the meaning of claims about clock precision/accuracy?
I've seen a lot of discussions of system clocks where it's said that e.g. standard PC clocks under e.g. Windows are precise only +/-10ms, whereas on a real time system clocks have submillisecond precision. But what do these claims mean? How…

Matt Phillips
- 9,465
- 8
- 44
- 75
3
votes
1 answer
Do I use Fortran system_clock correctly?
I am using the function system_clock with Fortran90 (compiled with gfortran) in the following way :
! Variables for clock
integer count_0, count_1
integer count_rate, count_max
double precision time_init, time_final, elapsed_time
!…
user1773603
3
votes
6 answers
How to execute a task after a certain time period in Android?
I create an application with lots of fragments . In my last fragment I try to print something on LogCatafter 10 seconds . But it dosen't work for me .
This is my Fragment class
public class StepTwentyTwoFragment extends Fragment {
@Override
…

Terance Wijesuriya
- 1,928
- 9
- 31
- 61
3
votes
1 answer
SystemClock() is not public in 'android.os.SystemClock'
I'm trying to code the game loop for an android game, however, i've come across this error when trying to access the current time (you know, for FPS management etc)
"SystemClock() is not public in 'android.os.SystemClock'. Cannot be accessed from…

Tirafesi
- 1,297
- 2
- 18
- 36
3
votes
1 answer
ExecutorService how to change scheduling clock
I am using Java executorservice to create a timeout effect in one of my apps. After an elapsed time, they executor service begins and logs the user out of their session. But on an Android device when the device goes to sleep the executor thread is…

j2emanue
- 60,549
- 65
- 286
- 456
3
votes
2 answers
With what could we replace SystemClock.elapsedRealtime() to get a reliable time?
I have an android service in charge to update a clock and to execute specific task (as playing song) at different time.
I tried to use things like Timer.scheduleAtFixedRate(new MyTask(), 0, 1000L) but I got more than 4 minutes of delay in 1h.
Now I…

Pierre_C
- 81
- 6
3
votes
0 answers
VirtualBox Ubuntu VM doesn't automatically sync time with host even with Guest Additions installed
I'm running a Ubuntu VM with VirtualBox and I have both the dkms and virtualbox-guest-additions packages installed. I read in this answer that the system clock should sync with the host automatically with the Guest Additions, but mine doesn't seem…

3cheesewheel
- 9,133
- 9
- 39
- 59
2
votes
1 answer
How to synchronize clock with Spotify servers?
I'm trying to create cool visualization to music using the Spotify Web API(https://developer.spotify.com/documentation/web-api/reference/).
What I'm trying, is to first fetch what the user is playing, what's their progress and then I fetch the track…

johnyka
- 399
- 3
- 15
2
votes
1 answer
Chronometer is still running after calling stop?
I am trying to implement a chronometer with hour minute and seconds format. when I call stop the chronometer still keeps counting the time and gets added to it once I start the chronometer again. I also don't want the chronometer to be reset,…

BlueDaBaDee
- 43
- 6
2
votes
1 answer
How do you show milliseconds on the time on vb
I have a clock on VB and i have got it to say the date and time but it wont show the milliseconds on the time.
time = DateTime.Now.ToString("dd/mm/yy HH:mm:ss")
So I know how to put the hours minuets and seconds but im not sure how to add…

Nathan
- 41
- 5
2
votes
1 answer
How can I modify time in Robolectric in order to fire an alarm
I'm trying to test a method with Robolectric (first contact with Robolectric).
I would like to set the system clock forward in order to fire an alarm, which was previously set with:
alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, alarmDelay,…

Hélène
- 377
- 1
- 5
- 13
2
votes
0 answers
Android synchronize clock programmatically
I'm developing an application that:
1. Runs in close network (no internet access).
2. All target devices have root permission.
I need to synchronized the device clock with my server clock each hour.
I found that I can't change default ntp…

NickF
- 5,637
- 12
- 44
- 75
2
votes
1 answer
Need to create a batch script countdown timer synchronised to the system clock
I would like to create a batch file countdown timer (needs to be batch script due to restrictions in place). I've used two scripts so far that 'kind of' do the job, but have their own downsides.
The criteria is as follows:
1. Needs to show system…

Modem7
- 21
- 1
- 3
2
votes
3 answers
Objective C / Swift version of Java's SystemClock.uptimeMillis()
I have a java app that uses SystemClock.upTimeMillis(), but now I am trying to replicate the code in Swift (New apple language) for the same app on iOS using the same concepts.
I need to get the clock to reset the seconds to 00 once it reaches 60,…
user3723418