timing

Time sync between two processes - .NET

南笙酒味 提交于 2019-12-24 11:26:11
问题 I have two programs written in .NET that communicate with acquisition hardware via USB. One device is asynchronous, but it tells me down to the microsecond when a data point was recorded. The other one is synchronous, that is, I know when each data point was recorded. I have .NET programs to interface with these. Until now, I have used DateTime.Now to establish when acquisition started, then I use the millisecond/microsecond time reported by the asynchronous device and the sample number from

Preventing a BPM ticker from slowly drifting out of sync with a real metronome

两盒软妹~` 提交于 2019-12-24 08:25:33
问题 I'm working on a music generator that takes a BPM value as input, after which it will start generating some chords, bass notes, and triggering a drum VSTi using MIDI signals. In order to keep everything running at the correct number of beats per minutes, I'm using a wall clock timer that starts the clock at 0 when you hit play, and then starts counting 1/128th notes as "ticks" at a regular interval. Every time the function ticks over, I check how many ticks into the future we are by simply

Does setTimeout in JavaScript accept real (floating point) delay times_

我怕爱的太早我们不能终老 提交于 2019-12-23 17:34:02
问题 I was just looking at JavaScript Timing Events, and there it says that " The second parameter indicates how many milliseconds from now you want to execute the first parameter. " Now, I know that in JavaScript, both floating point and integers are of type Number , and so syntactically I can enter a floating point value, e.g. ' setTimeout("javascript statement",4.5); ' - however, will JavaScript even attempt to create a delay of 4.5 milliseconds there; or will it just automatically truncate to

How do I delay a vb.net program until a file operation completes?

筅森魡賤 提交于 2019-12-23 15:44:41
问题 I have this: Dim myTemp As String myTemp = System.DateTime.Now().ToString("MMMddyyyy_HHmmss") & ".pdf" System.IO.File.Copy(myFile, "c:\" & myTemp) Application.DoEvents() OpenFile(myTemp) The problem is that when I call OpenFile, which is just a call to a sub that opens a file, it cannot find the file. This is because it is calling it so quickly that the program doesn't have time to actually create the file before the open takes place. I thought that DoEvents() would rectify this but it does

Mock timing in a context to create models with a field DateTimeField with auto_now_add=True

核能气质少年 提交于 2019-12-23 13:16:19
问题 I'd like to mock timing so that be able to set certain time to a field of type DateTimeField with auto_now_add=True during my tests e.g: class MyModel: ... created_at = models.DateTimeField(auto_now_add=True) ... class TestMyModel(TestCase): ... def test_something(self): # mock current time so that `created_at` be something like 1800-02-09T020000 my_obj = MyModel.objects.create(<whatever>) # and here my_obj.created_at == 1800-02-09T000000 I'm aware the current date is always used for this

How to timestamp request logs with millisecond accuracy in Apache 2.0

北城余情 提交于 2019-12-23 12:27:21
问题 How do I configure Apache 2.0's log format so that it timestamps each request log with millisecond (or microsecond) accuracy? The docs say that timestamps are specified in strftime format and strftime doesn't seem to handle anyting smaller than seconds. 回答1: I don't think it's possible (without rewriting APR, atleast). Apache uses apr_strftime. On Unix, this calls the C library's strftime, but doesn't even fill milliseconds into struct tm (not surprisingly, because this structure doesn't

touchesMoved called at irregular intervals

廉价感情. 提交于 2019-12-23 10:41:05
问题 I'm making a game for iOS where you mostly drag big objects across the screen. When I run the game on an actual iPad/iPhone for a while (continuously dragging the object in circles across the screen) every 5 minutes or so the dragged object goes all stuttery for about 10-30 seconds . Then, it goes back to moving silky-smooth. Visually, it looks like the game's frame rate dropped to 15 fps for a while, but in actual fact it's running at rock-solid 60 fps all the time. However, I noticed that

touchesMoved called at irregular intervals

我只是一个虾纸丫 提交于 2019-12-23 10:40:40
问题 I'm making a game for iOS where you mostly drag big objects across the screen. When I run the game on an actual iPad/iPhone for a while (continuously dragging the object in circles across the screen) every 5 minutes or so the dragged object goes all stuttery for about 10-30 seconds . Then, it goes back to moving silky-smooth. Visually, it looks like the game's frame rate dropped to 15 fps for a while, but in actual fact it's running at rock-solid 60 fps all the time. However, I noticed that

how to stop timer with another function javascript

感情迁移 提交于 2019-12-23 10:17:01
问题 So I have this code function timer() { setTimeout(function(){alert("Out of time")}, 3000); //Alerts "Out of time" after 3000 milliseconds } function resetTime() { timer(); //this is not right, i thought it would override the first function but it just adds another timer as well which is not what I want } function stopTime() { //What could go here to stop the first function from fully executing before it hits 3000 milliseconds and displays the alert message? } the function timer() starts as

How do I achieve very accurate timing in Swift?

大城市里の小女人 提交于 2019-12-23 07:59:52
问题 I am working on a musical app with an arpeggio/sequencing feature that requires great timing accuracy. Currently, using `Timer' I have achieved an accuracy with an average jitter of ~5ms, but a max jitter of ~11ms, which is unacceptable for fast arpeggios of 8th, 16th notes & 32nd notes especially. I've read the 'CADisplayLink' is more accurate than 'Timer', but since it is limited to 1/60th of a second for it's accuracy (~16-17ms), it seems like it would be a less accurate approach than what