Jump to content

RunTimeTicks microseconds, milliseconds, or nanoseconds?


kingargyle

Recommended Posts

kingargyle

I've managed to get Emby 3.3 server (yeah I know its old but that is the max version of my main media server pc that can support right now), to server up Movie information to my app.  However in trying to display the duration of a movie, I don't know what time format the value RunTimeTicks is stored..   It definitely doesn't appear to be milliseconds.  So what time unit is it?

 

Dave

 

 

Link to comment
Share on other sites

kingargyle

microseconds

 

Okay, this Kotlin function seems to do what I need:

 

companion object {

const val TICKS_PER_MILLISECOND: Long = 10000

}

fun convertTicksToMilliseconds(ticks: Long): Long = ticks.div(TICKS_PER_MILLISECOND)

 

I'll just have to make sure I use that and convert back and forth as needed, since the other server I access stores everything in milliseconds.

Link to comment
Share on other sites

  • 1 year later...
mpg732

I could use some help here.  I am queering the feed back from the server.  I am currently have a song playing but paused.  When I query the session the data shows  "PositionTicks": 472702690, and "RunTimeTicks": 1830196830,.  All other data seems to be correct.  So if the "Ticks" are in micro seconds, according to the data the run time of this song comes out to 30.5 minutes and is paused at  7.88 minutes.  The song actual time is 3.03 minutes long.  What am i dong wrong?

 

Thanks

Mike

Link to comment
Share on other sites

mpg732

That is what the server is returning.  I am getting that info right from the Emby Server API page.  If I drop the last zero it still does not convert properly.  it converts to 3:05 minutes and the song is 3:03 minutes

Link to comment
Share on other sites

PenkethBoy

1830196830 = 183.019683 second or 3.03 minutes and change

Edited by PenkethBoy
Link to comment
Share on other sites

mpg732

Interesting I was using Google converter.  I was putting the value in Microseconds and convert to minutes.  that comes out at 3:05.  if I change it from Microseconds to seconds it comes out to the 183.019683.  Interesting that Google failed.  But what about the last zero you mentioned earlier.  It is there in the feedback, is that supposed to be there?

Link to comment
Share on other sites

PenkethBoy

Yes

 

seconds = (divide runtimeticks by 10000000)

then if you want minutes divide again by 60

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...