duration

Groovy time durations

一世执手 提交于 2019-12-03 09:25:16
Hi I'm trying to calculate the difference (duration) between two times in Groovy. e.g. start = "2010-10-07T22:15:33.110+01:00" stop = "2010-10-07T22:19:52.356+01:00" Ideally I would like the get the duration returned in Hours, Minutes, Seconds, Milliseconds. Can anybody please help. I've tried to use Groovy's duration classes but have not been able to make any progress. Thanks for your assistance. If you just want to find the difference between two times you create yourself (for instance to see how long something takes to execute) you could use: import groovy.time.* def timeStart = new Date()

Using a duration field in a Rails model

送分小仙女□ 提交于 2019-12-03 02:44:45
问题 I'm looking for the best way to use a duration field in a Rails model. I would like the format to be HH:MM:SS (ex: 01:30:23). The database in use is sqlite locally and Postgres in production. I would also like to work with this field so I can take a look at all of the objects in the field and come up with the total time of all objects in that model and end up with something like: 30 records totaling 45 hours, 25 minutes, and 34 seconds. So what would work best for? Field type for the

How to get the real, actual duration of an MP3 file (VBR or CBR) server-side

≯℡__Kan透↙ 提交于 2019-12-03 01:24:26
I used to calculate the duration of MP3 files server-side using ffmpeg - which seemed to work fine. Today i discovered that some of the calculations were wrong. Somehow, for some reason, ffmpeg will miscalculate the duration and it seems to happen with variable bit rate mp3 files only. When testing this locally, i noticed that ffmpeg printed two extra lines in green. Command used: ffmpeg -i song_9747c077aef8.mp3 ffmpeg says: [mp3 @ 0x102052600] max_analyze_duration 5000000 reached at 5015510 [mp3 @ 0x102052600] Estimating duration from bitrate, this may be inaccurate After a nice, warm google

I am getting wrong time between two dates in Joda-Time

谁都会走 提交于 2019-12-03 01:21:38
问题 I am getting incorrect results whatever I do. Could anyone give me some advise please :). Here is the code of my program the is responsible for getting the time between two dates. I am getting a result but the problem is that it is incorrect and I have having trouble finding the problem. I have to Joda library in my project. if (timerightnow.isSelected()) { DateFormat getdate = new SimpleDateFormat("dd/MM/yy HH:mm:ss"); Date getdate1 = new Date(); String datenow = getdate1.toString(); String

How to measure and display the running time of a single test?

你说的曾经没有我的故事 提交于 2019-12-03 00:03:50
I have a potentially long-running test written with scalatest : test("a long running test") { failAfter(Span(60, Seconds)) { // ... } } Even if the test finishes within the timeout limit, its running time can be valuable to the person who runs the test. How can I measure and display the running time of this single particular test in scalatest's output? Update: Currently I measure the running time with my own function, just as in r.v's answer. I'd like to know if scalatest offers this functionality already. the -oD option will give the duration of the test. For example, I use the following in

Using a duration field in a Rails model

北慕城南 提交于 2019-12-02 16:38:46
I'm looking for the best way to use a duration field in a Rails model. I would like the format to be HH:MM:SS (ex: 01:30:23). The database in use is sqlite locally and Postgres in production. I would also like to work with this field so I can take a look at all of the objects in the field and come up with the total time of all objects in that model and end up with something like: 30 records totaling 45 hours, 25 minutes, and 34 seconds. So what would work best for? Field type for the migration Form field for the CRUD forms (hour, minute, second drop downs?) Least expensive method to generate

Wrong DURATION in MediaStore.Video.Media.DURATION

你离开我真会死。 提交于 2019-12-02 11:22:29
问题 I'm trying to record video in my application and I've noticed that displaying their duration , I see wrong minutes \ seconds. This happens only with the video recorded trough the following code. With the video recorded through other apps, the duration is displayed right: public void recordStream() { //Release Camera before MediaRecorder start releaseCamera(); if(!prepareMediaRecorder()){ Toast.makeText(MainActivity.this, "Fail in prepareMediaRecorder()!\n - Ended -", Toast.LENGTH_LONG).show()

Login, logout and duration time in php and mysql?

与世无争的帅哥 提交于 2019-12-02 10:27:42
I would like to store the login, logout and duration time in database. The login time is created when the user is authenticated(successfully logged in) The logout time is created when the user clicks the logout button The duration is logout - login time. (logout minus login) But the problem is, what if the user didnt click the logout button. Here are the situations: Internet loss Close the browser/tab. (I need this must use javascript, but i donnu how to do it, any idea?) EDIT: I forgot to add something to the question, the program is a full flash program, there is no navigation to other page.

calculate time taken to cover a journey in Apple Maps

穿精又带淫゛_ 提交于 2019-12-02 07:38:52
问题 I am working on MKMapView to get the direction between 2 locations.Is there any way i can get the time it may take in completing this journey?Is there any inbuilt property of MKRoute or MKDirection Class that can provide me time to cover this journey ? Any help would be appreciated. Thanks Vikas 回答1: Yes. The MKDirections method named calculateETAWithCompletionHandler: can just be a bit easy to overlook, though. An implementation could look as follows: MKDirections *yourDirections = ...;

How to dynamically adjust the duration/speed of a Tween Animation in Android

荒凉一梦 提交于 2019-12-02 07:04:29
问题 Let's say I have an android app, and in that app I want to animate a graphic of a ball in an "L" shape. This would require me to define a Tween Animation where I create an animation xml file (written below) and apply it to a View which has the ball graphic in it. <translate> Ydelta = 20; offset = 0; duration = 100; </translate> <translate> Xdelta = 20; offset = 100; duration = 100; </translate> Now lets say I want to control the speed of this animation dynamically so that over time, the L