Jump to content

TimerInit/TimerDiff ?


Vegar
 Share

Recommended Posts

Is there any way not to make it say (for example): 5726.1654567876 sec...

i want it to say: 01:35:26 (hour:min:sec)

how? :)

have checked the help file but did not find the answer to my problem.

Edited by Vegar
Link to comment
Share on other sites

Local $iTimerDiff = 5726000 ; should be a value returned by TimerDiff()

ConsoleWrite(_TimerFormat($iTimerDiff) & @CRLF)

Func _TimerFormat($iTimerDiff)
    $iTimerDiff = Floor($iTimerDiff / 1000)

    Local $iSEC = Mod($iTimerDiff, 60)
    $iTimerDiff = Floor($iTimerDiff / 60)

    Local $iMIN = Mod($iTimerDiff, 60)
    $iTimerDiff = Floor($iTimerDiff / 60)

    Local $iHOUR = Mod($iTimerDiff, 60)
    $iTimerDiff = Floor($iTimerDiff / 60)

    Return StringFormat("%.2d:%.2d:%.2d", $iHOUR, $iMIN, $iSEC)
EndFunc

Edited by -Ultima-

[ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]

Link to comment
Share on other sites

ok, Thanx..

but i'm kind of a noob with autoit so i could not find out where in the script i shoud put it.

so could i get some help? :)

Where can i copy it in, in this (for example):

#include <GuiConstants.au3>
$itimerdiff = TimerInit()



GuiCreate("Sample GUI", 400, 400)


$Knapp_1 = GuiCtrlCreateButton("Knapp", 160, 160, 100, 30)


GUISetState ()   


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Knapp_1
            MsgBox(0, "Running Time", TimerDiff($itimerdiff)/1000&" seconds")
    EndSelect
Wend


GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd
Link to comment
Share on other sites

#include <GuiConstants.au3>
$itimerdiff = TimerInit()



GuiCreate("Sample GUI", 400, 400)


$Knapp_1 = GuiCtrlCreateButton("Knapp", 160, 160, 100, 30)

GUISetState ()     


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Knapp_1
            MsgBox(0, "Running Time", _TimerFormat(TimerDiff($itimerdiff))&" (hour:min:sec)")
    EndSelect
Wend



Func _TimerFormat($iTimerDiff)
    $iTimerDiff = Floor($iTimerDiff / 1000)

    Local $iSEC = Mod($iTimerDiff, 60)
    $iTimerDiff = Floor($iTimerDiff / 60)

    Local $iMIN = Mod($iTimerDiff, 60)
    $iTimerDiff = Floor($iTimerDiff / 60)

    Local $iHOUR = Mod($iTimerDiff, 60)
    $iTimerDiff = Floor($iTimerDiff / 60)

    Return StringFormat("%.2d:%.2d:%.2d", $iHOUR, $iMIN, $iSEC)
EndFunc

Edited by -Ultima-

[ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...