Skip to Content
It is currently November 12th, 2019, 4:29 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: November 6th, 2019, 6:51 am 
Offline
Senior User
Senior User

Joined: September 7th, 2018, 9:00 am
Posts: 108
Hi

how can I turn, in PAL, a value in milliseconds into a string "mm:ss", please?


Top
 Profile  
Reply with quote  
PostPosted: November 7th, 2019, 12:48 pm 
Offline
Senior User
Senior User

Joined: September 7th, 2018, 9:00 am
Posts: 108
This works fine.
It can be used for Duration of the songs
Code:
var Milliseconds : float;
var hh, mm, ss, th, tm, ts : float; // hh = hour, mm = minutes, ss = seconds, th = temporary hours, tm = temporary minutes, ts = temporary seconds
var WaitTime, h, m, s : string;

Milliseconds := 256157;
ss := Milliseconds div 1000;
mm := ss div 60;
th := mm div 60;
tm := mm mod 60;
ts := ss mod 60;

s := FloatToStr(ts);
m := FloatToStr(tm);
h := FloatToStr(th);

{Seconds Management}
IF ts = 60 THEN
  BEGIN
    s := '00';
  END;
IF ts < 10 THEN
  BEGIN
    s := '0'+FloatToStr(ts);
  END;

{Minutes Management}
IF tm = 60 THEN
  BEGIN
    m := '00';
  END;
IF tm < 10 THEN
  BEGIN
    m := '0'+FloatToStr(tm);
  END;

{Hours Management}
IF th = 24 THEN
  BEGIN
    h := '00';
  END;
IF th < 10 THEN
  BEGIN
    h := '0'+FloatToStr(th);
  END;
 
WaitTime := '+00:'+m+':'+s;
writeLn(WaitTime);
writeLn(Now);
PAL.WaitForTime(WaitTime);
writeLn(Now);


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group