25 May '13 - 06:26 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Remaining time  (Read 441 times)
Sariman
Posts: 13


« on: 18 Oct '12 - 15:56 »
Reply with quoteQuote

Hello friends! How to implement the remaining time in the format "-00:00:00"?
Thanks in advance.

P.S I'm using Delphi.
« Last Edit: 18 Oct '12 - 16:01 by Sariman » Logged
ken
Posts: 630


« Reply #1 on: 20 Oct '12 - 12:50 »
Reply with quoteQuote

Hello friends! How to implement the remaining time in the format "-00:00:00"?
Thanks in advance.

P.S I'm using Delphi.


something like this:


pos = Bass.BASS_ChannelGetLength(channel) - Bass.BASS_ChannelGetPosition(channel, BASSMode.BASS_POS_BYTES)
seconds = Bass.BASS_ChannelBytes2Seconds(channel, pos)


How you format seconds to 00:00:00, I can't say since I don't code in Delphi.



Logged
Sariman
Posts: 13


« Reply #2 on: 20 Oct '12 - 15:24 »
Reply with quoteQuote

Hello friends! How to implement the remaining time in the format "-00:00:00"?
Thanks in advance.

P.S I'm using Delphi.


something like this:


pos = Bass.BASS_ChannelGetLength(channel) - Bass.BASS_ChannelGetPosition(channel, BASSMode.BASS_POS_BYTES)
seconds = Bass.BASS_ChannelBytes2Seconds(channel, pos)


How you format seconds to 00:00:00, I can't say since I don't code in Delphi.


Thank you!)
Logged
Sariman
Posts: 13


« Reply #3 on: 20 Oct '12 - 15:44 »
Reply with quoteQuote

all who are interested, here's the code:
function LeftTime: string;
var
  RemainingTimeValue: Double;
  RemainingTime: string;
begin
  RemainingTimeValue := (TrackLengthValue - CurrentPos) / (24 * 3600);
  RemainingTime := FormatDateTime('hh:mm:ss', RemainingTimeValue);
  Result := RemainingTime;
end;
Logged
fmcoder
Posts: 386


« Reply #4 on: 20 Oct '12 - 16:43 »
Reply with quoteQuote

  RemainingTime := FormatDateTime('hh:mm:ss', RemainingTimeValue);
The mm format specifier is a month Smiley for minutes you should use nn instead.
Logged
Sariman
Posts: 13


« Reply #5 on: 20 Oct '12 - 19:40 »
Reply with quoteQuote

oh thank you)
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines