Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Sun Aug 09, 2020 2:32 am

All times are UTC




Post a reply
Username:
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
Font size:
Font colour
Options:
BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Please click and drag the 2 correct statements to the right hand side.
Please click and drag the 2 correct statements to the right hand side.
Please select the options below to the correct list to avoid automated registrations.
Statements
2 correct statements
Fish can swim
Elephants can fly
Dogs have 4 legs
Chickens can talk
   

Topic review - Code: Convert milliseconds to hh:mm:ss
Author Message
  Post subject:  Re: Code: Convert milliseconds to hh:mm:ss  Reply with quote
very cool!
Post Posted: Sat Nov 02, 2019 5:55 am
  Post subject:  Code: Convert milliseconds to hh:mm:ss  Reply with quote
Example code to convert milliseconds, as returned by a stopwatch, to zero-filled hh:mm:ss.
Code:
 begin
     // convert milliseconds to hh:mm:ss (whole seconds)
     Variable.Set("runtime", "20000000")
     Function.Execute("convert ms to hhmmss")
 end

function("convert ms to hhmmss")
     begin
          Variable.Copy("runtime", "ms")
          Variable.Divide (Math)("ms", "1000")
          Variable.Floor (Math)("ms")
          Variable.Copy("ms", "s")
          Variable.To modulo (Math)("s", "60")
          Variable.Copy("ms", "m")
          Variable.Divide (Math)("m", "60")
          Variable.Floor (Math)("m")
          Variable.Copy("m", "h")
          Variable.To modulo (Math)("m", "60")
          Variable.Divide (Math)("h", "60")
          Variable.Floor (Math)("h")
          Function.Execute setting 3 variables("ZeroFillTime","strHour", "{h}", "strMinutes", "{m}", "strSeconds", "{s}")
          Window.Display message box("{strFormattedTime}", "yes")
     end
function

function("ZeroFillTime")
     begin
          if  Variable.Is less than (Math)("strHour", "10")
               begin
                    Variable.Evaluate (Text)("0{strHour}", "strHour")
               end
          if  Variable.Is less than (Math)("strMinutes", "10")
               begin
                    Variable.Evaluate (Text)("0{strMinutes}", "strMinutes")
               end
          if  Variable.Is less than (Math)("strSeconds", "10")
               begin
                    Variable.Evaluate (Text)("0{strSeconds}", "strSeconds")
               end
          Variable.Evaluate (Text)("{strHour}:{strMinutes}:{strSeconds}", "strFormattedTime")
     end
function
Post Posted: Fri Nov 01, 2019 11:59 pm

All times are UTC


Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group