magace Posted August 19, 2014 Posted August 19, 2014 (edited) Yea idk why this is confusign me so much. Should of studied harder in math! I need to convert $ctime to day/hr/min/sec format Local $hTimer = TimerInit() Local $rtime = 2 * 86400000 ;2 days in ms While 1 sleep(1000) Local $fDiff = TimerDiff($hTimer) Local $ctime = $rtime - $fDiff if $fDiff > $rtime Then ;GetnPost() ToolTip("TIMESUP!!!!",0,0) Sleep(5000) Local $hTimer = TimerInit() Else ToolTip("TIMELEFT: " & $ctime,0,0) EndIf WEnd Thanks for viewing! Edited August 19, 2014 by magace
Belini Posted August 19, 2014 Posted August 19, 2014 (edited) see if this is what you need: example1() example2() Func example1() $miliseconds = 43200000 $day = ($miliseconds / 43200000) $hour = ($miliseconds / 3600000) $min = ($miliseconds / 60000) $sec = ($miliseconds / 1000) MsgBox(4096, "Example 1", "converted milliseconds to day = " & $day & " day(s)" & _ @CRLF & "converted milliseconds to hour = " & $hour & " hour(s)" & @CRLF & _ "converted milliseconds to minute = " & $min & " minute(s)" & @CRLF & _ "converted milliseconds to second = " & $sec & " seconds(s)") EndFunc ;==>example1 Func example2() $miliseconds = 49536000 $day = Int($miliseconds / 43200000) $hour = Int(Mod($miliseconds, 43200000) / 3600000) $min = Int(Mod(Mod($miliseconds, 43200000), 3600000) / 60000) $sec = Int(Mod(Mod(Mod($miliseconds, 43200000), 3600000), 60000) / 1000) $time = $day & " day(s) and " & StringFormat("%02d:%02d:%02d", $hour, $min, $sec) MsgBox(4096, "Example 2", $time) EndFunc ;==>example2 Edited August 19, 2014 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
mikell Posted August 19, 2014 Posted August 19, 2014 #include <Date.au3> $hTimer = TimerInit() $rtime = 2 * 86400000 ;2 days in ms While 1 sleep(1000) Local $fDiff = TimerDiff($hTimer) Local $ctime = $rtime - $fDiff if $fDiff > $rtime Then ;GetnPost() ToolTip("TIMESUP!!!!",0,0) Sleep(5000) Local $hTimer = TimerInit() Else ToolTip("TIMELEFT: " & _Convert($ctime), 0, 0) EndIf WEnd Func _Convert($ms) Local $day, $hour, $min, $sec _TicksToTime($ms, $hour, $min, $sec) If $hour > 24 Then $day = $hour/24 $hour = Mod($hour, 24) EndIf Return StringFormat("%02i/%02i/%02i/%02i", $day, $hour, $min, $sec) EndFunc argumentum and BrewManNH 2
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now